diff options
author | Bill Haneman <bill.haneman@sun.com> | 2003-06-06 23:20:37 +0000 |
---|---|---|
committer | Jonathan Blandford <jrb@src.gnome.org> | 2003-06-06 23:20:37 +0000 |
commit | be432c9acb542263f6a16da9e40e31ba59f9315c (patch) | |
tree | 0edce1bc098cec22c9936a34154f3512606ded7f | |
parent | 27cd2a87b04a49809ddbcf37e349ac7c655f8d3d (diff) | |
download | gnome-control-center-be432c9acb542263f6a16da9e40e31ba59f9315c.tar.gz |
Use a peditor for the visual bell instead.
Fri Jun 6 19:16:43 2003 Jonathan Blandford <jrb@gnome.org>
* sound-properties-capplet.c (bell_flash_to_widget),
(bell_flash_from_widget): Use a peditor for the visual bell
instead.
2003-06-06 Bill Haneman <bill.haneman@sun.com>
* sound-properties.glade:
Added page tab and UI from "visual bell" capplet
(UI originally from Calum, except for ugly icon)
* visual-bell.png:
Ugly new icon which needs TLC from Calum.
* sound-properties-capplet.c:
Added gconf keys for visual bell feature and control of
audio bell.
(visual_bell_type_changed): New, called when visual bell radiobuttons
are toggled.
(create_dialog):
Set the image on the "System Bell" notebook tab.
(setup_dialog):
Added peditors for visual-bell and audio-bell checkboxes/gconf keys.
Added guards for the visual-bell type buttons, controlled by
the visual-bell-enabling checkbox.
Connected visual_bell_type_changed to "toggled" signal on radiobuttons.
-rw-r--r-- | capplets/sound/ChangeLog | 28 | ||||
-rw-r--r-- | capplets/sound/Makefile.am | 6 | ||||
-rw-r--r-- | capplets/sound/sound-properties-capplet.c | 84 | ||||
-rw-r--r-- | capplets/sound/sound-properties.glade | 209 |
4 files changed, 311 insertions, 16 deletions
diff --git a/capplets/sound/ChangeLog b/capplets/sound/ChangeLog index 8d60cfd0d..38a13c629 100644 --- a/capplets/sound/ChangeLog +++ b/capplets/sound/ChangeLog @@ -1,3 +1,31 @@ +Fri Jun 6 19:16:43 2003 Jonathan Blandford <jrb@gnome.org> + + * sound-properties-capplet.c (bell_flash_to_widget), + (bell_flash_from_widget): Use a peditor for the visual bell + instead. + +2003-06-06 Bill Haneman <bill.haneman@sun.com> + + * sound-properties.glade: + Added page tab and UI from "visual bell" capplet + (UI originally from Calum, except for ugly icon) + + * visual-bell.png: + Ugly new icon which needs TLC from Calum. + + * sound-properties-capplet.c: + Added gconf keys for visual bell feature and control of + audio bell. + (visual_bell_type_changed): New, called when visual bell radiobuttons + are toggled. + (create_dialog): + Set the image on the "System Bell" notebook tab. + (setup_dialog): + Added peditors for visual-bell and audio-bell checkboxes/gconf keys. + Added guards for the visual-bell type buttons, controlled by + the visual-bell-enabling checkbox. + Connected visual_bell_type_changed to "toggled" signal on radiobuttons. + 2003-05-07 Jody Goldberg <jody@gnome.org> * Release 2.3.1 diff --git a/capplets/sound/Makefile.am b/capplets/sound/Makefile.am index 9d615d475..a892489f2 100644 --- a/capplets/sound/Makefile.am +++ b/capplets/sound/Makefile.am @@ -11,8 +11,8 @@ Glade_DATA = sound-properties.glade iconsdir = $(GNOMECC_ICONS_DIR) icons_DATA = sound-capplet.png -desktop_iconsdir = $(datadir)/pixmaps -desktop_icons_DATA = sound-capplet.png +desktop_iconsdir = $(GNOMECC_PIXMAPS_DIR) +desktop_icons_DATA = sound-capplet.png visual-bell.png desktopdir = $(GNOMECC_DESKTOP_DIR) Desktop_in_files = sound.desktop.in @@ -20,5 +20,5 @@ desktop_DATA = $(Desktop_in_files:.desktop.in=.desktop) INCLUDES = $(GNOMECC_CAPPLETS_CFLAGS) $(SOUND_CAPPLET_CFLAGS) CLEANFILES = $(GNOMECC_CAPPLETS_CLEANFILES) -EXTRA_DIST = $(Glade_DATA) $(icons_DATA) $(Desktop_in_files) +EXTRA_DIST = $(Glade_DATA) $(desktop_icons_DATA) $(Desktop_in_files) diff --git a/capplets/sound/sound-properties-capplet.c b/capplets/sound/sound-properties-capplet.c index c03b39839..e756bdd31 100644 --- a/capplets/sound/sound-properties-capplet.c +++ b/capplets/sound/sound-properties-capplet.c @@ -41,6 +41,12 @@ #include "activate-settings-daemon.h" +#define ENABLE_ESD_KEY "/desktop/gnome/sound/enable_esd" +#define EVENT_SOUNDS_KEY "/desktop/gnome/sound/event_sounds" +#define VISUAL_BELL_KEY "/apps/metacity/general/visual_bell" +#define AUDIO_BELL_KEY "/apps/metacity/general/audible_bell" +#define VISUAL_BELL_TYPE_KEY "/apps/metacity/general/visual_bell_type" + /* Capplet-specific prototypes */ static SoundProperties *props = NULL; @@ -51,6 +57,46 @@ props_changed_cb (SoundProperties *p, SoundEvent *event, gpointer data) sound_properties_user_save (p); } + + +static GConfEnumStringPair bell_flash_enums[] = { + { 0, "frame_flash" }, + { 1, "fullscreen_flash" }, + { -1, NULL } +}; + +static GConfValue * +bell_flash_from_widget (GConfPropertyEditor *peditor, const GConfValue *value) +{ + GConfValue *new_value; + + new_value = gconf_value_new (GCONF_VALUE_STRING); + gconf_value_set_string (new_value, + gconf_enum_to_string (bell_flash_enums, gconf_value_get_int (value))); + + return new_value; +} + +static GConfValue * +bell_flash_to_widget (GConfPropertyEditor *peditor, const GConfValue *value) +{ + GConfValue *new_value; + const gchar *str; + gint val = 2; + + str = (value && (value->type == GCONF_VALUE_STRING)) ? gconf_value_get_string (value) : NULL; + + new_value = gconf_value_new (GCONF_VALUE_INT); + if (value->type == GCONF_VALUE_STRING) { + gconf_string_to_enum (bell_flash_enums, + str, + &val); + } + gconf_value_set_int (new_value, val); + + return new_value; +} + /* create_dialog * * Create the dialog box and return it as a GtkWidget @@ -59,27 +105,30 @@ props_changed_cb (SoundProperties *p, SoundEvent *event, gpointer data) static GladeXML * create_dialog (void) { - GladeXML *data; + GladeXML *dialog; GtkWidget *widget, *box; - data = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/sound-properties.glade", "prefs_widget", NULL); - widget = glade_xml_get_widget (data, "prefs_widget"); - g_object_set_data (G_OBJECT (widget), "glade-data", data); + dialog = glade_xml_new (GNOMECC_DATA_DIR "/interfaces/sound-properties.glade", "prefs_widget", NULL); + widget = glade_xml_get_widget (dialog, "prefs_widget"); + g_object_set_data (G_OBJECT (widget), "glade-data", dialog); props = sound_properties_new (); sound_properties_add_defaults (props, NULL); g_signal_connect (G_OBJECT (props), "event_changed", (GCallback) props_changed_cb, NULL); - box = glade_xml_get_widget (data, "events_vbox"); + box = glade_xml_get_widget (dialog, "events_vbox"); gtk_box_pack_start (GTK_BOX (box), sound_view_new (props), TRUE, TRUE, 0); g_signal_connect_swapped (G_OBJECT (widget), "destroy", (GCallback) gtk_object_destroy, props); - gtk_widget_set_size_request (widget, -1, 250); + gtk_image_set_from_file (GTK_IMAGE (WID ("bell_image")), + GNOMECC_DATA_DIR "/pixmaps/visual-bell.png"); - return data; + gtk_widget_set_size_request (widget, -1, 250); /* Can this be right? Seems broken for large fonts. */ + + return dialog; } /* setup_dialog @@ -91,11 +140,27 @@ static void setup_dialog (GladeXML *dialog, GConfChangeSet *changeset) { GObject *peditor; + gchar *visual_type; + GtkWidget *flash_titlebar_widget, *flash_screen_widget; - peditor = gconf_peditor_new_boolean (NULL, "/desktop/gnome/sound/enable_esd", WID ("enable_toggle"), NULL); + peditor = gconf_peditor_new_boolean (NULL, ENABLE_ESD_KEY, WID ("enable_toggle"), NULL); gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("events_toggle")); gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("events_vbox")); - peditor = gconf_peditor_new_boolean (NULL, "/desktop/gnome/sound/event_sounds", WID ("events_toggle"), NULL); + + gconf_peditor_new_boolean (NULL, EVENT_SOUNDS_KEY, WID ("events_toggle"), NULL); + + gconf_peditor_new_boolean (NULL, AUDIO_BELL_KEY, WID ("bell_audible_toggle"), NULL); + + peditor = gconf_peditor_new_boolean (NULL, VISUAL_BELL_KEY, WID ("bell_visual_toggle"), NULL); + gconf_peditor_widget_set_guard (GCONF_PROPERTY_EDITOR (peditor), WID ("bell_flash_vbox")); + + /* peditor not so convenient for the radiobuttons */ + gconf_peditor_new_select_radio (NULL, + VISUAL_BELL_TYPE_KEY, + gtk_radio_button_get_group (GTK_RADIO_BUTTON (WID ("bell_flash_window_radio"))), + "conv-to-widget-cb", bell_flash_to_widget, + "conv-from-widget-cb", bell_flash_from_widget, + NULL); } /* get_legacy_settings @@ -163,6 +228,7 @@ main (int argc, char **argv) client = gconf_client_get_default (); gconf_client_add_dir (client, "/desktop/gnome/sound", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); + gconf_client_add_dir (client, "/apps/metacity/general", GCONF_CLIENT_PRELOAD_ONELEVEL, NULL); if (get_legacy) { get_legacy_settings (); diff --git a/capplets/sound/sound-properties.glade b/capplets/sound/sound-properties.glade index 370e93888..d980c8079 100644 --- a/capplets/sound/sound-properties.glade +++ b/capplets/sound/sound-properties.glade @@ -20,15 +20,14 @@ <property name="show_border">True</property> <property name="tab_pos">GTK_POS_TOP</property> <property name="scrollable">False</property> - <property name="tab_hborder">2</property> - <property name="tab_vborder">2</property> <property name="enable_popup">False</property> <child> <widget class="GtkVBox" id="vbox1"> + <property name="border_width">8</property> <property name="visible">True</property> <property name="homogeneous">False</property> - <property name="spacing">5</property> + <property name="spacing">8</property> <child> <widget class="GtkCheckButton" id="enable_toggle"> @@ -95,6 +94,7 @@ <child> <widget class="GtkVBox" id="events_vbox"> + <property name="border_width">8</property> <property name="visible">True</property> <property name="homogeneous">False</property> <property name="spacing">0</property> @@ -106,9 +106,210 @@ </child> <child> - <widget class="GtkLabel" id="label2"> + <widget class="GtkLabel" id="label4"> <property name="visible">True</property> <property name="label" translatable="yes">Sound Events</property> + <property name="use_underline">False</property> + <property name="use_markup">False</property> + <property name="justify">GTK_JUSTIFY_LEFT</property> + <property name="wrap">False</property> + <property name="selectable">False</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="type">tab</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="bell_vbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkHBox" id="hbox2"> + <property name="border_width">8</property> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">8</property> + + <child> + <widget class="GtkImage" id="bell_image"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0</property> + <property name="xpad">0</property> + <property name="ypad">0</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="vbox4"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">3</property> + + <child> + <widget class="GtkCheckButton" id="bell_audible_toggle"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Sound an audible bell</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">True</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkCheckButton" id="bell_visual_toggle"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">_Visual feedback:</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">0</property> + + <child> + <widget class="GtkAlignment" id="alignment3"> + <property name="visible">True</property> + <property name="xalign">0.5</property> + <property name="yalign">0.5</property> + <property name="xscale">0</property> + <property name="yscale">1</property> + + <child> + <widget class="GtkFrame" id="frame2"> + <property name="width_request">20</property> + <property name="visible">True</property> + <property name="label_xalign">0</property> + <property name="label_yalign">0.5</property> + <property name="shadow_type">GTK_SHADOW_NONE</property> + + <child> + <placeholder/> + </child> + </widget> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkVBox" id="bell_flash_vbox"> + <property name="visible">True</property> + <property name="homogeneous">False</property> + <property name="spacing">3</property> + + <child> + <widget class="GtkRadioButton" id="bell_flash_window_radio"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Flash _window titlebar</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + + <child> + <widget class="GtkRadioButton" id="bell_flash_screen_radio"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="label" translatable="yes">Flash entire _screen</property> + <property name="use_underline">True</property> + <property name="relief">GTK_RELIEF_NORMAL</property> + <property name="active">False</property> + <property name="inconsistent">False</property> + <property name="draw_indicator">True</property> + <property name="group">bell_flash_window_radio</property> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">False</property> + <property name="fill">False</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="padding">0</property> + <property name="expand">True</property> + <property name="fill">True</property> + </packing> + </child> + </widget> + <packing> + <property name="tab_expand">False</property> + <property name="tab_fill">True</property> + </packing> + </child> + + <child> + <widget class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="label" translatable="yes">System Bell</property> <property name="use_underline">True</property> <property name="use_markup">False</property> <property name="justify">GTK_JUSTIFY_CENTER</property> |