From 7241f0420628857bdda11b6dd90e90d00b4dbd35 Mon Sep 17 00:00:00 2001 From: Bradford Hovinen Date: Mon, 17 Dec 2001 18:17:57 +0000 Subject: [PATCH] Retrieve the applier from the preferences object and use it to apply 2001-12-17 Bradford Hovinen * background-properties-capplet.c (peditor_value_changed): Retrieve the applier from the preferences object and use it to apply settings on the preview widget --- capplets/background/ChangeLog | 5 ++++ .../background-properties-capplet.c | 30 ++++++++++++++++--- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/capplets/background/ChangeLog b/capplets/background/ChangeLog index 3a3dd5de4..cb9b5fc95 100644 --- a/capplets/background/ChangeLog +++ b/capplets/background/ChangeLog @@ -4,6 +4,11 @@ opacity controls (dialog_button_clicked_cb): Apply settings after commiting the change set + (peditor_value_changed): Implement + (setup_dialog): Connect value-changed signals + (setup_dialog): Store the applier in the preferences object + (peditor_value_changed): Retrieve the applier from the preferences + object and use it to apply settings on the preview widget * background.schema: Added wallpaper-enabled diff --git a/capplets/background/background-properties-capplet.c b/capplets/background/background-properties-capplet.c index 4563a5ec4..9e613a376 100644 --- a/capplets/background/background-properties-capplet.c +++ b/capplets/background/background-properties-capplet.c @@ -172,6 +172,22 @@ realize_cb (GtkWidget *widget, Preferences *prefs) gtk_timeout_add (100, (GtkFunction) realize_2_cb, prefs); } +static void +peditor_value_changed (GConfPropertyEditor *peditor, const gchar *key, const GConfValue *value, Preferences *prefs) +{ + GConfEntry *entry; + Applier *applier; + + entry = gconf_entry_new (key, value); + preferences_merge_entry (prefs, entry); + gconf_entry_free (entry); + + applier = g_object_get_data (G_OBJECT (prefs), "applier"); + + if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier))) + applier_apply_prefs (applier, PREFERENCES (prefs)); +} + static void setup_dialog (GtkWidget *widget, GConfChangeSet *changeset) { @@ -181,12 +197,20 @@ setup_dialog (GtkWidget *widget, GConfChangeSet *changeset) GConfEngine *engine; GObject *peditor; + prefs = preferences_new (); + preferences_load (PREFERENCES (prefs)); + dialog = g_object_get_data (G_OBJECT (widget), "glade-data"); peditor = gconf_peditor_new_select_menu (changeset, "/background-properties/orientation", WID ("color_option")); + g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs); peditor = gconf_peditor_new_color (changeset, "/background-properties/color1", WID ("colorpicker1")); + g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs); peditor = gconf_peditor_new_color (changeset, "/background-properties/color2", WID ("colorpicker2")); + g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs); peditor = gconf_peditor_new_filename (changeset, "/background-properties/wallpaper-filename", WID ("image_fileentry")); + g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs); peditor = gconf_peditor_new_select_menu (changeset, "/background-properties/wallpaper-type", WID ("image_option")); + g_signal_connect (peditor, "value-changed", (GCallback) peditor_value_changed, prefs); #if 0 gconf_peditor_new_int_spin (changeset, "/background-properties/opacity", WID ("opacity_spin")); @@ -203,12 +227,10 @@ setup_dialog (GtkWidget *widget, GConfChangeSet *changeset) engine = gconf_engine_get_default (); gconf_engine_set_bool (engine, "enabled", TRUE, NULL); - prefs = preferences_new (); - preferences_load (PREFERENCES (prefs)); + applier = g_object_get_data (G_OBJECT (widget), "applier"); g_object_set_data (prefs, "glade-data", dialog); - - applier = g_object_get_data (G_OBJECT (widget), "applier"); + g_object_set_data (prefs, "applier", applier); if (GTK_WIDGET_REALIZED (applier_get_preview_widget (applier))) applier_apply_prefs (applier, PREFERENCES (prefs));