[nautilus] desktop-metadata: group multiple desktop metadata saving calls



commit 25754a54bb0889187d9b5cb45e6c32ae9321f038
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Tue Feb 1 09:19:44 2011 -0500

    desktop-metadata: group multiple desktop metadata saving calls

 libnautilus-private/nautilus-desktop-metadata.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-metadata.c b/libnautilus-private/nautilus-desktop-metadata.c
index b9c0d4d..80dcfe4 100644
--- a/libnautilus-private/nautilus-desktop-metadata.c
+++ b/libnautilus-private/nautilus-desktop-metadata.c
@@ -36,6 +36,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+static guint save_in_idle_source_id = 0;
+
 static gchar *
 get_keyfile_path (void)
 {
@@ -57,6 +59,8 @@ save_in_idle_cb (gpointer data)
 	gsize length;
 	GError *error = NULL;
 
+	save_in_idle_source_id = 0;
+
 	contents = g_key_file_to_data (keyfile, &length, NULL);
 	filename = get_keyfile_path ();
 
@@ -78,7 +82,11 @@ save_in_idle_cb (gpointer data)
 static void
 save_in_idle (GKeyFile *keyfile)
 {
-	g_idle_add (save_in_idle_cb, keyfile);
+	if (save_in_idle_source_id != 0) {
+		g_source_remove (save_in_idle_source_id);
+	}
+
+	save_in_idle_source_id = g_idle_add (save_in_idle_cb, keyfile);
 }
 
 static GKeyFile *



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