[nautilus] Avoid delays in background switching



commit 99e66a93605e056c80cebb4c3ac9b6b58167ad1c
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Apr 21 15:27:45 2009 +0200

    Avoid delays in background switching
    
    Don't delay background switching, so that users will immediately see
    it changing when browsing the background list (#330168).
    
    Signed-off-by: Cosimo Cecchi <cosimoc gnome org>
---
 .../nautilus-directory-background.c                |   21 ++++++++++++-------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/libnautilus-private/nautilus-directory-background.c b/libnautilus-private/nautilus-directory-background.c
index 94ec5fd..08503d6 100644
--- a/libnautilus-private/nautilus-directory-background.c
+++ b/libnautilus-private/nautilus-directory-background.c
@@ -309,15 +309,20 @@ desktop_background_gconf_notify_cb (GConfClient *client, guint notification_id,
 	guint notification_timeout_id;
 	
 	background = EEL_BACKGROUND (data);
-	/* 
-	 * Wallpaper capplet changes picture, background color and placement with
-	 * gconf_change_set API, but unfortunately, this operation is not atomic in
-	 * GConf as it should be. So we update background after small timeout to
-	 * let GConf change all values.
-	 */
-	notification_timeout_id = g_timeout_add (300, (GSourceFunc) call_settings_changed, background);
 
-	g_object_set_data (G_OBJECT (background), "desktop_gconf_notification_timeout", GUINT_TO_POINTER (notification_timeout_id));
+	notification_timeout_id = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (background), "desktop_gconf_notification_timeout"));
+
+        if (strcmp (entry->key, "/desktop/gnome/background/stamp") == 0) {
+                if (notification_timeout_id != 0) 
+                        g_source_remove (notification_timeout_id);
+                
+                call_settings_changed (background);
+        }
+        else if (notification_timeout_id == 0) {
+                notification_timeout_id = g_timeout_add (300, (GSourceFunc) call_settings_changed, background);
+                
+                g_object_set_data (G_OBJECT (background), "desktop_gconf_notification_timeout", GUINT_TO_POINTER (notification_timeout_id));
+        }
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]