gnome-settings-daemon r283 - in trunk: . plugins/a11y-keyboard



Author: jensg
Date: Thu Apr 10 19:34:30 2008
New Revision: 283
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=283&view=rev

Log:
2008-04-10  Jens Granseuer  <jensgr gmx net>

	Make a11y-keyboard plugin deactivation work

	* plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c:
	(register_config_callback), (gsd_a11y_keyboard_manager_start),
	(gsd_a11y_keyboard_manager_stop): properly clean up on _stop
	* plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c:
	(impl_deactivate): stop manager on deactivation


Modified:
   trunk/ChangeLog
   trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
   trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c

Modified: trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c
==============================================================================
--- trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	(original)
+++ trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c	Thu Apr 10 19:34:30 2008
@@ -57,6 +57,9 @@
         gboolean   slowkeys_shortcut_val;
         GtkWidget *stickykeys_alert;
         GtkWidget *slowkeys_alert;
+
+        guint      gconf_notify;
+
 };
 
 #define GSD_KBD_A11Y_ERROR gsd_kbd_a11y_error_quark ()
@@ -702,17 +705,13 @@
 
 static void
 register_config_callback (GsdA11yKeyboardManager  *manager,
+                          GConfClient             *client,
                           const char              *path,
-                          GConfClientNotifyFunc    func)
+                          GConfClientNotifyFunc    func,
+                          guint                   *notify)
 {
-        GConfClient *client;
-
-        client = gconf_client_get_default ();
-
         gconf_client_add_dir (client, path, GCONF_CLIENT_PRELOAD_NONE, NULL);
-        gconf_client_notify_add (client, path, func, manager, NULL, NULL);
-
-        g_object_unref (client);
+        *notify = gconf_client_notify_add (client, path, func, manager, NULL, NULL);
 }
 
 gboolean
@@ -733,16 +732,19 @@
                 goto out;
         }
 
+        client = gconf_client_get_default ();
+
         register_config_callback (manager,
+                                  client,
                                   CONFIG_ROOT,
-                                  (GConfClientNotifyFunc) keyboard_callback);
+                                  (GConfClientNotifyFunc) keyboard_callback,
+                                  &manager->priv->gconf_notify);
 
         event_mask = XkbControlsNotifyMask;
 #ifdef DEBUG_ACCESSIBILITY
         event_mask |= XkbAccessXNotifyMask; /* make default when AXN_AXKWarning works */
 #endif
 
-        client = gconf_client_get_default ();
         /* be sure to init before starting to monitor the server */
         set_server_from_gconf (manager, client);
         g_object_unref (client);
@@ -768,7 +770,29 @@
 void
 gsd_a11y_keyboard_manager_stop (GsdA11yKeyboardManager *manager)
 {
+        GsdA11yKeyboardManagerPrivate *p = manager->priv;
+
         g_debug ("Stopping a11y_keyboard manager");
+
+        if (p->gconf_notify != 0) {
+                GConfClient *client = gconf_client_get_default ();
+                gconf_client_notify_remove (client, p->gconf_notify);
+                g_object_unref (client);
+                p->gconf_notify = 0;
+        }
+
+        gdk_window_remove_filter (NULL,
+                                  (GdkFilterFunc) cb_xkb_event_filter,
+                                  manager);
+
+        if (p->slowkeys_alert != NULL)
+                gtk_widget_destroy (p->slowkeys_alert);
+
+        if (p->stickykeys_alert != NULL)
+                gtk_widget_destroy (p->stickykeys_alert);
+
+        p->slowkeys_shortcut_val = FALSE;
+        p->stickykeys_shortcut_val = FALSE;
 }
 
 static void

Modified: trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c
==============================================================================
--- trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c	(original)
+++ trunk/plugins/a11y-keyboard/gsd-a11y-keyboard-plugin.c	Thu Apr 10 19:34:30 2008
@@ -86,6 +86,7 @@
 impl_deactivate (GnomeSettingsPlugin *plugin)
 {
         g_debug ("Deactivating a11y_keyboard plugin");
+        gsd_a11y_keyboard_manager_stop (GSD_A11Y_KEYBOARD_PLUGIN (plugin)->priv->manager);
 }
 
 static void



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