keyboard: Avoid warnings when adding new shortcuts
We don't want to unset GConf watches if we didn't set them in the first place.
This commit is contained in:
parent
83512fb6fe
commit
3d5c7b65a6
2 changed files with 7 additions and 3 deletions
|
@ -314,10 +314,9 @@ cc_keyboard_item_finalize (GObject *object)
|
||||||
/* Remove GConf watches */
|
/* Remove GConf watches */
|
||||||
client = gconf_client_get_default ();
|
client = gconf_client_get_default ();
|
||||||
|
|
||||||
/* FIXME what if we didn't add a watch? */
|
if (item->gconf_key_dir != NULL && item->monitored_dir)
|
||||||
if (item->gconf_key_dir != NULL)
|
|
||||||
gconf_client_remove_dir (client, item->gconf_key_dir, NULL);
|
gconf_client_remove_dir (client, item->gconf_key_dir, NULL);
|
||||||
else if (item->gconf_key != NULL)
|
else if (item->gconf_key != NULL && item->monitored)
|
||||||
gconf_client_remove_dir (client, item->gconf_key, NULL);
|
gconf_client_remove_dir (client, item->gconf_key, NULL);
|
||||||
|
|
||||||
if (item->gconf_cnxn != 0)
|
if (item->gconf_cnxn != 0)
|
||||||
|
@ -459,6 +458,7 @@ cc_keyboard_item_load_from_gconf (CcKeyboardItem *item,
|
||||||
}
|
}
|
||||||
item->editable = gconf_entry_get_is_writable (entry);
|
item->editable = gconf_entry_get_is_writable (entry);
|
||||||
gconf_client_add_dir (client, item->gconf_key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, item->gconf_key, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
item->monitored = TRUE;
|
||||||
item->gconf_cnxn = gconf_client_notify_add (client,
|
item->gconf_cnxn = gconf_client_notify_add (client,
|
||||||
item->gconf_key,
|
item->gconf_key,
|
||||||
(GConfClientNotifyFunc) &keybinding_key_changed,
|
(GConfClientNotifyFunc) &keybinding_key_changed,
|
||||||
|
@ -501,6 +501,7 @@ cc_keyboard_item_load_from_gconf_dir (CcKeyboardItem *item,
|
||||||
item->command = gconf_client_get_string (client, item->cmd_gconf_key, NULL);
|
item->command = gconf_client_get_string (client, item->cmd_gconf_key, NULL);
|
||||||
item->editable = gconf_entry_get_is_writable (entry);
|
item->editable = gconf_entry_get_is_writable (entry);
|
||||||
gconf_client_add_dir (client, item->gconf_key_dir, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
gconf_client_add_dir (client, item->gconf_key_dir, GCONF_CLIENT_PRELOAD_ONELEVEL, NULL);
|
||||||
|
item->monitored_dir = TRUE;
|
||||||
|
|
||||||
item->desc_editable = gconf_client_key_is_writable (client, item->desc_gconf_key, NULL);
|
item->desc_editable = gconf_client_key_is_writable (client, item->desc_gconf_key, NULL);
|
||||||
item->gconf_cnxn_desc = gconf_client_notify_add (client,
|
item->gconf_cnxn_desc = gconf_client_notify_add (client,
|
||||||
|
|
|
@ -72,6 +72,7 @@ typedef struct
|
||||||
char *gconf_key;
|
char *gconf_key;
|
||||||
guint gconf_cnxn;
|
guint gconf_cnxn;
|
||||||
gboolean editable;
|
gboolean editable;
|
||||||
|
gboolean monitored;
|
||||||
|
|
||||||
/* GCONF DIR */
|
/* GCONF DIR */
|
||||||
char *gconf_key_dir;
|
char *gconf_key_dir;
|
||||||
|
@ -87,6 +88,8 @@ typedef struct
|
||||||
gboolean cmd_editable;
|
gboolean cmd_editable;
|
||||||
guint gconf_cnxn_cmd;
|
guint gconf_cnxn_cmd;
|
||||||
|
|
||||||
|
gboolean monitored_dir;
|
||||||
|
|
||||||
/* GSettings */
|
/* GSettings */
|
||||||
char *schema;
|
char *schema;
|
||||||
char *key;
|
char *key;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue