diff options
author | Bradford Hovinen <hovinen@ximian.com> | 2002-01-04 20:48:17 +0000 |
---|---|---|
committer | Bradford Hovinen (Gdict maintainer) <hovinen@src.gnome.org> | 2002-01-04 20:48:17 +0000 |
commit | 68257fcb341a312e26758c9b40d2ec044a0e11e4 (patch) | |
tree | 656d2b8d1bbf4da27ebb88c73b933220e026d286 | |
parent | 2fc652eb94d9d2ca5d864f870cff29675b35788f (diff) | |
download | gnome-control-center-68257fcb341a312e26758c9b40d2ec044a0e11e4.tar.gz |
Implement. Sets the GConf value either in the changeset, or if changeset
2002-01-04 Bradford Hovinen <hovinen@ximian.com>
* gconf-property-editor.c (peditor_set_gconf_value):
Implement. Sets the GConf value either in the changeset, or if
changeset is NULL, directly
(peditor_*_widget_changed): Use peditor_set_gconf_value
(gconf_peditor_new_*): Don't complain if changeset is NULL
-rw-r--r-- | capplets/common/ChangeLog | 8 | ||||
-rw-r--r-- | capplets/common/gconf-property-editor.c | 36 | ||||
-rw-r--r-- | gnome-settings-daemon/ChangeLog | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-background.c | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-background.h | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-daemon.c | 26 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-daemon.h | 1 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-keyboard.c | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-keyboard.h | 5 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-mouse.c | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-mouse.h | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-sound.c | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-sound.h | 4 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-xsettings.c | 6 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-xsettings.h | 4 |
15 files changed, 68 insertions, 50 deletions
diff --git a/capplets/common/ChangeLog b/capplets/common/ChangeLog index bc5b6727f..90a72064f 100644 --- a/capplets/common/ChangeLog +++ b/capplets/common/ChangeLog @@ -1,3 +1,11 @@ +2002-01-04 Bradford Hovinen <hovinen@ximian.com> + + * gconf-property-editor.c (peditor_set_gconf_value): + Implement. Sets the GConf value either in the changeset, or if + changeset is NULL, directly + (peditor_*_widget_changed): Use peditor_set_gconf_value + (gconf_peditor_new_*): Don't complain if changeset is NULL + 2001-12-20 Bradford Hovinen <hovinen@ximian.com> * gconf-property-editor.c: Eliminate compiler warnings diff --git a/capplets/common/gconf-property-editor.c b/capplets/common/gconf-property-editor.c index 85ae4704e..936534df2 100644 --- a/capplets/common/gconf-property-editor.c +++ b/capplets/common/gconf-property-editor.c @@ -301,9 +301,9 @@ gconf_peditor_new (gchar *key, g_return_val_if_fail (cb != NULL, NULL); obj = g_object_new (gconf_property_editor_get_type (), - "key", key, - "callback", cb, - "changeset", changeset, + "key", key, + "callback", cb, + "changeset", changeset, "ui-control", ui_control, NULL); @@ -324,6 +324,17 @@ gconf_property_editor_get_key (GConfPropertyEditor *peditor) } static void +peditor_set_gconf_value (GConfPropertyEditor *peditor, + const gchar *key, + GConfValue *value) +{ + if (peditor->p->changeset != NULL) + gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + else + gconf_client_set (gconf_client_get_default (), peditor->p->key, value, NULL); +} + +static void peditor_boolean_value_changed (GConfClient *client, guint cnxn_id, GConfEntry *entry, @@ -351,7 +362,7 @@ peditor_boolean_widget_changed (GConfPropertyEditor *peditor, value_wid = gconf_value_new (GCONF_VALUE_BOOL); gconf_value_set_bool (value_wid, gtk_toggle_button_get_active (tb)); value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); gconf_value_free (value); @@ -367,7 +378,6 @@ gconf_peditor_new_boolean (GConfChangeSet *changeset, GObject *peditor; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (checkbox != NULL, NULL); g_return_val_if_fail (GTK_IS_TOGGLE_BUTTON (checkbox), NULL); @@ -418,7 +428,7 @@ peditor_string_widget_changed (GConfPropertyEditor *peditor, value_wid = gconf_value_new (GCONF_VALUE_STRING); gconf_value_set_string (value_wid, gtk_entry_get_text (entry)); value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); gconf_value_free (value); @@ -457,7 +467,6 @@ gconf_peditor_new_string (GConfChangeSet *changeset, GObject *peditor; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (entry != NULL, NULL); g_return_val_if_fail (GTK_IS_ENTRY (entry), NULL); @@ -483,7 +492,6 @@ gconf_peditor_new_filename (GConfChangeSet *changeset, GObject *peditor; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (file_entry != NULL, NULL); g_return_val_if_fail (GNOME_IS_FILE_ENTRY (file_entry), NULL); @@ -541,7 +549,7 @@ peditor_color_widget_changed (GConfPropertyEditor *peditor, value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); @@ -558,7 +566,6 @@ gconf_peditor_new_color (GConfChangeSet *changeset, GObject *peditor; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (cp != NULL, NULL); g_return_val_if_fail (GNOME_IS_COLOR_PICKER (cp), NULL); @@ -609,7 +616,7 @@ peditor_select_menu_widget_changed (GConfPropertyEditor *peditor, value_wid = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (value_wid, gtk_option_menu_get_history (option_menu)); value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); gconf_value_free (value); @@ -625,7 +632,6 @@ gconf_peditor_new_select_menu (GConfChangeSet *changeset, GObject *peditor; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (option_menu != NULL, NULL); g_return_val_if_fail (GTK_IS_OPTION_MENU (option_menu), NULL); @@ -682,7 +688,7 @@ peditor_select_radio_widget_changed (GConfPropertyEditor *peditor, gconf_value_set_int (value_wid, g_slist_index (group, tb)); value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); @@ -701,7 +707,6 @@ gconf_peditor_new_select_radio (GConfChangeSet *changeset, GSList *item; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (radio_group != NULL, NULL); g_return_val_if_fail (radio_group->data != NULL, NULL); @@ -757,7 +762,7 @@ peditor_numeric_range_widget_changed (GConfPropertyEditor *peditor, value_wid = gconf_value_new (GCONF_VALUE_FLOAT); gconf_value_set_float (value_wid, gtk_adjustment_get_value (adjustment)); value = peditor->p->conv_from_widget_cb (value_wid); - gconf_change_set_set (peditor->p->changeset, peditor->p->key, value); + peditor_set_gconf_value (peditor, peditor->p->key, value); g_signal_emit (peditor, peditor_signals[VALUE_CHANGED], 0, peditor->p->key, value); gconf_value_free (value_wid); gconf_value_free (value); @@ -774,7 +779,6 @@ gconf_peditor_new_numeric_range (GConfChangeSet *changeset, GObject *adjustment; va_list var_args; - g_return_val_if_fail (changeset != NULL, NULL); g_return_val_if_fail (key != NULL, NULL); g_return_val_if_fail (range != NULL, NULL); g_return_val_if_fail (GTK_IS_RANGE (range), NULL); diff --git a/gnome-settings-daemon/ChangeLog b/gnome-settings-daemon/ChangeLog index 695c5a1f8..7b1bc5a64 100644 --- a/gnome-settings-daemon/ChangeLog +++ b/gnome-settings-daemon/ChangeLog @@ -1,3 +1,7 @@ +2002-01-04 Bradford Hovinen <hovinen@ximian.com> + + * all: Convert from GConfEngine to GConfClient + 2001-01-04 Richard Hestilow <hestilow@ximian.com> * gnome-settings-sound.[ch]: Added. diff --git a/gnome-settings-daemon/gnome-settings-background.c b/gnome-settings-daemon/gnome-settings-background.c index f9e832dd2..890743a74 100644 --- a/gnome-settings-daemon/gnome-settings-background.c +++ b/gnome-settings-daemon/gnome-settings-background.c @@ -47,7 +47,7 @@ background_callback (GConfEntry *entry) } void -gnome_settings_background_init (GConfEngine *engine) +gnome_settings_background_init (GConfClient *client) { bg_applier = BG_APPLIER (bg_applier_new (BG_APPLIER_ROOT)); @@ -58,7 +58,7 @@ gnome_settings_background_init (GConfEngine *engine) } void -gnome_settings_background_load (GConfEngine *engine) +gnome_settings_background_load (GConfClient *client) { bg_applier_apply_prefs (bg_applier, prefs); } diff --git a/gnome-settings-daemon/gnome-settings-background.h b/gnome-settings-daemon/gnome-settings-background.h index 92227d594..74aead612 100644 --- a/gnome-settings-daemon/gnome-settings-background.h +++ b/gnome-settings-daemon/gnome-settings-background.h @@ -27,7 +27,7 @@ #include <gconf/gconf.h> -void gnome_settings_background_init (GConfEngine *engine); -void gnome_settings_background_load (GConfEngine *engine); +void gnome_settings_background_init (GConfClient *client); +void gnome_settings_background_load (GConfClient *client); #endif diff --git a/gnome-settings-daemon/gnome-settings-daemon.c b/gnome-settings-daemon/gnome-settings-daemon.c index caee61081..1f473697a 100644 --- a/gnome-settings-daemon/gnome-settings-daemon.c +++ b/gnome-settings-daemon/gnome-settings-daemon.c @@ -85,7 +85,7 @@ gnome_settings_daemon_get_invisible (void) } static void -config_notify (GConfEngine *client, +config_notify (GConfClient *client, guint cnxn_id, GConfEntry *entry, gpointer user_data) @@ -131,7 +131,7 @@ int main (int argc, char **argv) { gboolean terminated = FALSE; - GConfEngine *engine; + GConfClient *client; GSList *list; gtk_init (&argc, &argv); @@ -154,25 +154,26 @@ main (int argc, char **argv) gconf_init (argc, argv, NULL); /* exits w/ message on failure */ - /* We use GConfEngine not GConfClient because a cache isn't useful + /* We use GConfClient not GConfClient because a cache isn't useful * for us */ - engine = gconf_engine_get_default (); - gnome_settings_xsettings_init (engine); - gnome_settings_mouse_init (engine); - gnome_settings_keyboard_init (engine); - gnome_settings_background_init (engine); - gnome_settings_sound_init (engine); + client = gconf_client_get_default (); + gnome_settings_xsettings_init (client); + gnome_settings_mouse_init (client); + gnome_settings_keyboard_init (client); + gnome_settings_background_init (client); + gnome_settings_sound_init (client); for (list = directories; list; list = list->next) { GError *error = NULL; DirElement *dir_element = list->data; - gconf_engine_notify_add (engine, + gconf_client_notify_add (client, dir_element->dir, config_notify, NULL, + NULL, &error); if (error) @@ -185,14 +186,13 @@ main (int argc, char **argv) gdk_window_add_filter (NULL, manager_event_filter, NULL); - gnome_settings_xsettings_load (engine); - gnome_settings_mouse_load (engine); + gnome_settings_xsettings_load (client); + gnome_settings_mouse_load (client); if (!terminated) gtk_main (); xsettings_manager_destroy (manager); - gconf_engine_unref (engine); return 0; } diff --git a/gnome-settings-daemon/gnome-settings-daemon.h b/gnome-settings-daemon/gnome-settings-daemon.h index 20f66bdd1..c3a247f40 100644 --- a/gnome-settings-daemon/gnome-settings-daemon.h +++ b/gnome-settings-daemon/gnome-settings-daemon.h @@ -25,6 +25,7 @@ #define __GNOME_SETTINGS_DAEMON_H #include <gconf/gconf.h> +#include <gconf/gconf-client.h> #include <gtk/gtk.h> diff --git a/gnome-settings-daemon/gnome-settings-keyboard.c b/gnome-settings-daemon/gnome-settings-keyboard.c index b9b30c17b..997bd883a 100644 --- a/gnome-settings-daemon/gnome-settings-keyboard.c +++ b/gnome-settings-daemon/gnome-settings-keyboard.c @@ -94,13 +94,13 @@ apply_settings (void) } void -gnome_settings_keyboard_init (GConfEngine *engine) +gnome_settings_keyboard_init (GConfClient *client) { gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/keyboard", (KeyCallbackFunc) apply_settings); } void -gnome_settings_keyboard_load (GConfEngine *engine) +gnome_settings_keyboard_load (GConfClient *client) { apply_settings (); } diff --git a/gnome-settings-daemon/gnome-settings-keyboard.h b/gnome-settings-daemon/gnome-settings-keyboard.h index 71f564e09..503081bea 100644 --- a/gnome-settings-daemon/gnome-settings-keyboard.h +++ b/gnome-settings-daemon/gnome-settings-keyboard.h @@ -26,8 +26,9 @@ #define __GNOME_SETTINGS_KEYBOARD_H #include <gconf/gconf.h> +#include <gconf/gconf-client.h> -void gnome_settings_keyboard_init (GConfEngine *engine); -void gnome_settings_keyboard_load (GConfEngine *engine); +void gnome_settings_keyboard_init (GConfClient *client); +void gnome_settings_keyboard_load (GConfClient *client); #endif diff --git a/gnome-settings-daemon/gnome-settings-mouse.c b/gnome-settings-daemon/gnome-settings-mouse.c index 731195c35..c3038da25 100644 --- a/gnome-settings-daemon/gnome-settings-mouse.c +++ b/gnome-settings-daemon/gnome-settings-mouse.c @@ -162,13 +162,13 @@ mouse_callback (GConfEntry *entry) } void -gnome_settings_mouse_init (GConfEngine *engine) +gnome_settings_mouse_init (GConfClient *client) { gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/mouse", mouse_callback); } void -gnome_settings_mouse_load (GConfEngine *engine) +gnome_settings_mouse_load (GConfClient *client) { } diff --git a/gnome-settings-daemon/gnome-settings-mouse.h b/gnome-settings-daemon/gnome-settings-mouse.h index 80f018d79..0a6a0943b 100644 --- a/gnome-settings-daemon/gnome-settings-mouse.h +++ b/gnome-settings-daemon/gnome-settings-mouse.h @@ -26,7 +26,7 @@ #include <gconf/gconf.h> -void gnome_settings_mouse_init (GConfEngine *engine); -void gnome_settings_mouse_load (GConfEngine *engine); +void gnome_settings_mouse_init (GConfClient *client); +void gnome_settings_mouse_load (GConfClient *client); #endif diff --git a/gnome-settings-daemon/gnome-settings-sound.c b/gnome-settings-daemon/gnome-settings-sound.c index fab0e9d8f..44205c691 100644 --- a/gnome-settings-daemon/gnome-settings-sound.c +++ b/gnome-settings-daemon/gnome-settings-sound.c @@ -162,13 +162,13 @@ apply_settings (void) } void -gnome_settings_sound_init (GConfEngine *engine) +gnome_settings_sound_init (GConfClient *client) { gnome_settings_daemon_register_callback ("/desktop/gnome/sound", (KeyCallbackFunc) apply_settings); } void -gnome_settings_sound_load (GConfEngine *engine) +gnome_settings_sound_load (GConfClient *client) { apply_settings (); } diff --git a/gnome-settings-daemon/gnome-settings-sound.h b/gnome-settings-daemon/gnome-settings-sound.h index 68da5b036..650988a2b 100644 --- a/gnome-settings-daemon/gnome-settings-sound.h +++ b/gnome-settings-daemon/gnome-settings-sound.h @@ -27,7 +27,7 @@ #include <gconf/gconf.h> -void gnome_settings_sound_init (GConfEngine *engine); -void gnome_settings_sound_load (GConfEngine *engine); +void gnome_settings_sound_init (GConfClient *client); +void gnome_settings_sound_load (GConfClient *client); #endif /* __GNOME_SETTINGS_SOUND_H__ */ diff --git a/gnome-settings-daemon/gnome-settings-xsettings.c b/gnome-settings-daemon/gnome-settings-xsettings.c index 24cb09240..82b0e7019 100644 --- a/gnome-settings-daemon/gnome-settings-xsettings.c +++ b/gnome-settings-daemon/gnome-settings-xsettings.c @@ -151,14 +151,14 @@ xsettings_callback (GConfEntry *entry) } void -gnome_settings_xsettings_init (GConfEngine *engine) +gnome_settings_xsettings_init (GConfClient *client) { gnome_settings_daemon_register_callback ("/desktop/gnome/peripherals/mouse", xsettings_callback); gnome_settings_daemon_register_callback ("/desktop/gtk", xsettings_callback); } void -gnome_settings_xsettings_load (GConfEngine *engine) +gnome_settings_xsettings_load (GConfClient *client) { int i; @@ -169,7 +169,7 @@ gnome_settings_xsettings_load (GConfEngine *engine) GError *err; err = NULL; - val = gconf_engine_get (engine, + val = gconf_client_get (client, translations[i].gconf_key, &err); diff --git a/gnome-settings-daemon/gnome-settings-xsettings.h b/gnome-settings-daemon/gnome-settings-xsettings.h index 9888d4ac0..259258c29 100644 --- a/gnome-settings-daemon/gnome-settings-xsettings.h +++ b/gnome-settings-daemon/gnome-settings-xsettings.h @@ -26,8 +26,8 @@ #include <gconf/gconf.h> -void gnome_settings_xsettings_init (GConfEngine *engine); -void gnome_settings_xsettings_load (GConfEngine *engine); +void gnome_settings_xsettings_init (GConfClient *client); +void gnome_settings_xsettings_load (GConfClient *client); #endif /* GNOME_SETTINGS_XSETTINGS_H */ |