[gnome-settings-daemon] plugins: Make sure we mop up stray idle handlers



commit e98c9079eec9cd9f6f27dd7813d96d6ba536e6c2
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 16 16:43:01 2011 +0000

    plugins: Make sure we mop up stray idle handlers

 plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c |    9 +++++++--
 plugins/clipboard/gsd-clipboard-manager.c         |    8 +++++++-
 plugins/keyboard/gsd-keyboard-manager.c           |    8 +++++++-
 plugins/media-keys/gsd-media-keys-manager.c       |    9 ++++++++-
 plugins/mouse/gsd-mouse-manager.c                 |    8 +++++++-
 plugins/wacom/gsd-wacom-manager.c                 |    8 +++++++-
 plugins/xsettings/gsd-xsettings-manager.c         |    8 +++++++-
 7 files changed, 50 insertions(+), 8 deletions(-)
---
diff --git a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
index 7bf8d6a..3414033 100644
--- a/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
+++ b/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
@@ -52,6 +52,7 @@
 
 struct GsdA11yKeyboardManagerPrivate
 {
+        guint             start_idle_id;
         int               xkbEventBase;
         GdkDeviceManager *device_manager;
         guint             device_added_id;
@@ -968,17 +969,18 @@ start_a11y_keyboard_idle_cb (GsdA11yKeyboardManager *manager)
  out:
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
-
 gboolean
 gsd_a11y_keyboard_manager_start (GsdA11yKeyboardManager *manager,
                                  GError                **error)
 {
         gnome_settings_profile_start (NULL);
 
-        g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_a11y_keyboard_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -1187,6 +1189,9 @@ gsd_a11y_keyboard_manager_finalize (GObject *object)
 
         g_return_if_fail (a11y_keyboard_manager->priv != NULL);
 
+        if (a11y_keyboard_manager->priv->start_idle_id != 0)
+                g_source_remove (a11y_keyboard_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gsd_a11y_keyboard_manager_parent_class)->finalize (object);
 }
 
diff --git a/plugins/clipboard/gsd-clipboard-manager.c b/plugins/clipboard/gsd-clipboard-manager.c
index d9f3fde..73d49e4 100644
--- a/plugins/clipboard/gsd-clipboard-manager.c
+++ b/plugins/clipboard/gsd-clipboard-manager.c
@@ -51,6 +51,7 @@
 
 struct GsdClipboardManagerPrivate
 {
+        guint    start_idle_id;
         Display *display;
         Window   window;
         Time     timestamp;
@@ -920,6 +921,8 @@ start_clipboard_idle_cb (GsdClipboardManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -929,7 +932,7 @@ gsd_clipboard_manager_start (GsdClipboardManager *manager,
 {
         gnome_settings_profile_start (NULL);
 
-        g_idle_add ((GSourceFunc) start_clipboard_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_clipboard_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -1045,6 +1048,9 @@ gsd_clipboard_manager_finalize (GObject *object)
 
         g_return_if_fail (clipboard_manager->priv != NULL);
 
+        if (clipboard_manager->priv->start_idle_id !=0)
+                g_source_remove (clipboard_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gsd_clipboard_manager_parent_class)->finalize (object);
 }
 
diff --git a/plugins/keyboard/gsd-keyboard-manager.c b/plugins/keyboard/gsd-keyboard-manager.c
index 23e16d8..9e995a8 100644
--- a/plugins/keyboard/gsd-keyboard-manager.c
+++ b/plugins/keyboard/gsd-keyboard-manager.c
@@ -72,6 +72,7 @@
 
 struct GsdKeyboardManagerPrivate
 {
+	guint      start_idle_id;
         GSettings *settings;
         gboolean   have_xkb;
         gint       xkb_event_base;
@@ -388,6 +389,8 @@ start_keyboard_idle_cb (GsdKeyboardManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -397,7 +400,7 @@ gsd_keyboard_manager_start (GsdKeyboardManager *manager,
 {
         gnome_settings_profile_start (NULL);
 
-        g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_keyboard_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -505,6 +508,9 @@ gsd_keyboard_manager_finalize (GObject *object)
 
         g_return_if_fail (keyboard_manager->priv != NULL);
 
+        if (keyboard_manager->priv->start_idle_id != 0)
+                g_source_remove (keyboard_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gsd_keyboard_manager_parent_class)->finalize (object);
 }
 
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index cc0f81f..8fe0387 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -119,6 +119,8 @@ struct GsdMediaKeysManagerPrivate
         GDBusConnection *connection;
         GDBusProxy      *xrandr_proxy;
         GCancellable    *cancellable;
+
+        guint            start_idle_id;
 };
 
 static void     gsd_media_keys_manager_class_init  (GsdMediaKeysManagerClass *klass);
@@ -1398,6 +1400,8 @@ start_media_keys_idle_cb (GsdMediaKeysManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -1431,7 +1435,7 @@ gsd_media_keys_manager_start (GsdMediaKeysManager *manager,
 
         gnome_settings_profile_end ("gvc_mixer_control_new");
 #endif /* HAVE_PULSE */
-        g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_media_keys_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -1598,6 +1602,9 @@ gsd_media_keys_manager_finalize (GObject *object)
 
         g_return_if_fail (media_keys_manager->priv != NULL);
 
+        if (media_keys_manager->priv->start_idle_id != 0)
+                g_source_remove (media_keys_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gsd_media_keys_manager_parent_class)->finalize (object);
 }
 
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
index 18cafdf..53df94b 100644
--- a/plugins/mouse/gsd-mouse-manager.c
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -74,6 +74,7 @@
 
 struct GsdMouseManagerPrivate
 {
+	guint start_idle_id;
         GSettings *touchpad_settings;
         GSettings *mouse_settings;
         GSettings *mouse_a11y_settings;
@@ -988,6 +989,8 @@ gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -997,7 +1000,7 @@ gsd_mouse_manager_start (GsdMouseManager *manager,
 {
         gnome_settings_profile_start (NULL);
 
-        g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -1046,6 +1049,9 @@ gsd_mouse_manager_finalize (GObject *object)
 
         g_return_if_fail (mouse_manager->priv != NULL);
 
+        if (mouse_manager->priv->start_idle_id != 0)
+                g_source_remove (mouse_manager->priv->start_idle_id);
+
         if (mouse_manager->priv->device_manager != NULL)
                 g_signal_handler_disconnect (mouse_manager->priv->device_manager, mouse_manager->priv->device_added_id);
 
diff --git a/plugins/wacom/gsd-wacom-manager.c b/plugins/wacom/gsd-wacom-manager.c
index 0d616e7..f447a07 100644
--- a/plugins/wacom/gsd-wacom-manager.c
+++ b/plugins/wacom/gsd-wacom-manager.c
@@ -75,6 +75,7 @@
 
 struct GsdWacomManagerPrivate
 {
+	guint start_idle_id;
         GSettings *wacom_settings;
         GSettings *stylus_settings;
         GSettings *eraser_settings;
@@ -574,6 +575,8 @@ gsd_wacom_manager_idle_cb (GsdWacomManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -583,7 +586,7 @@ gsd_wacom_manager_start (GsdWacomManager *manager,
 {
         gnome_settings_profile_start (NULL);
 
-        g_idle_add ((GSourceFunc) gsd_wacom_manager_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) gsd_wacom_manager_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 
@@ -640,6 +643,9 @@ gsd_wacom_manager_finalize (GObject *object)
 
         g_return_if_fail (wacom_manager->priv != NULL);
 
+        if (wacom_manager->priv->start_idle_id != 0)
+                g_source_remove (wacom_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gsd_wacom_manager_parent_class)->finalize (object);
 }
 
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index 5181c4a..709d9f8 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -87,6 +87,7 @@ struct _TranslationEntry {
 
 struct GnomeXSettingsManagerPrivate
 {
+        guint              start_idle_id;
         XSettingsManager **managers;
         GHashTable        *settings;
 
@@ -469,6 +470,8 @@ start_fontconfig_monitor_idle_cb (GnomeXSettingsManager *manager)
 
         gnome_settings_profile_end (NULL);
 
+        manager->priv->start_idle_id = 0;
+
         return FALSE;
 }
 
@@ -479,7 +482,7 @@ start_fontconfig_monitor (GnomeXSettingsManager  *manager)
 
         fontconfig_cache_init ();
 
-        g_idle_add ((GSourceFunc) start_fontconfig_monitor_idle_cb, manager);
+        manager->priv->start_idle_id = g_idle_add ((GSourceFunc) start_fontconfig_monitor_idle_cb, manager);
 
         gnome_settings_profile_end (NULL);
 }
@@ -804,6 +807,9 @@ gnome_xsettings_manager_finalize (GObject *object)
 
         g_return_if_fail (xsettings_manager->priv != NULL);
 
+        if (xsettings_manager->priv->start_idle_id != 0)
+                g_source_remove (xsettings_manager->priv->start_idle_id);
+
         G_OBJECT_CLASS (gnome_xsettings_manager_parent_class)->finalize (object);
 }
 



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