gnome-settings-daemon r290 - in trunk: . plugins/keybindings
- From: jensg svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r290 - in trunk: . plugins/keybindings
- Date: Thu, 10 Apr 2008 20:55:51 +0100 (BST)
Author: jensg
Date: Thu Apr 10 20:55:51 2008
New Revision: 290
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=290&view=rev
Log:
2008-04-10 Jens Granseuer <jensgr gmx net>
Make keybinding plugin deactivation work
* plugins/keybindings/gsd-keybindings-manager.c:
(register_config_callback), (gsd_keybindings_manager_start),
(gsd_keybindings_manager_stop): clean up properly on stop
* plugins/keybindings/gsd-keybindings-plugin.c: (impl_deactivate):
stop manager on deactivation
Modified:
trunk/ChangeLog
trunk/plugins/keybindings/gsd-keybindings-manager.c
trunk/plugins/keybindings/gsd-keybindings-plugin.c
Modified: trunk/plugins/keybindings/gsd-keybindings-manager.c
==============================================================================
--- trunk/plugins/keybindings/gsd-keybindings-manager.c (original)
+++ trunk/plugins/keybindings/gsd-keybindings-manager.c Thu Apr 10 20:55:51 2008
@@ -74,6 +74,7 @@
{
GSList *binding_list;
GSList *screens;
+ guint notify;
};
static void gsd_keybindings_manager_class_init (GsdKeybindingsManagerClass *klass);
@@ -554,19 +555,14 @@
binding_register_keys (manager);
}
-static void
+static guint
register_config_callback (GsdKeybindingsManager *manager,
+ GConfClient *client,
const char *path,
GConfClientNotifyFunc func)
{
- 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);
+ return gconf_client_notify_add (client, path, func, manager, NULL, NULL);
}
gboolean
@@ -587,19 +583,20 @@
dpy = gdk_display_get_default ();
screen_num = gdk_display_get_n_screens (dpy);
- register_config_callback (manager,
- GCONF_BINDING_DIR,
- (GConfClientNotifyFunc)bindings_callback);
-
for (i = 0; i < screen_num; i++) {
screen = gdk_display_get_screen (dpy, i);
gdk_window_add_filter (gdk_screen_get_root_window (screen),
- (GdkFilterFunc)keybindings_filter,
+ (GdkFilterFunc) keybindings_filter,
manager);
}
client = gconf_client_get_default ();
+ manager->priv->notify = register_config_callback (manager,
+ client,
+ GCONF_BINDING_DIR,
+ (GConfClientNotifyFunc) bindings_callback);
+
list = gconf_client_all_dirs (client, GCONF_BINDING_DIR, NULL);
manager->priv->screens = get_screens_list ();
@@ -621,7 +618,37 @@
void
gsd_keybindings_manager_stop (GsdKeybindingsManager *manager)
{
+ GsdKeybindingsManagerPrivate *p = manager->priv;
+ GSList *l;
+
g_debug ("Stopping keybindings manager");
+
+ if (p->notify != 0) {
+ GConfClient *client = gconf_client_get_default ();
+ gconf_client_remove_dir (client, GCONF_BINDING_DIR, NULL);
+ gconf_client_notify_remove (client, p->notify);
+ g_object_unref (client);
+ p->notify = 0;
+ }
+
+ for (l = p->screens; l; l = l->next) {
+ GdkScreen *screen = l->data;
+ gdk_window_remove_filter (gdk_screen_get_root_window (screen),
+ (GdkFilterFunc) keybindings_filter,
+ manager);
+ }
+ g_slist_free (p->screens);
+ p->screens = NULL;
+
+ for (l = p->binding_list; l; l = l->next) {
+ Binding *b = l->data;
+ g_free (b->binding_str);
+ g_free (b->action);
+ g_free (b->gconf_key);
+ g_free (b);
+ }
+ g_slist_free (p->binding_list);
+ p->binding_list = NULL;
}
static void
Modified: trunk/plugins/keybindings/gsd-keybindings-plugin.c
==============================================================================
--- trunk/plugins/keybindings/gsd-keybindings-plugin.c (original)
+++ trunk/plugins/keybindings/gsd-keybindings-plugin.c Thu Apr 10 20:55:51 2008
@@ -86,6 +86,7 @@
impl_deactivate (GnomeSettingsPlugin *plugin)
{
g_debug ("Deactivating keybindings plugin");
+ gsd_keybindings_manager_stop (GSD_KEYBINDINGS_PLUGIN (plugin)->priv->manager);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]