[glib/new-gsettings] Do not send a changed signal when a non-existing key is reset
- From: Vincent Untz <vuntz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/new-gsettings] Do not send a changed signal when a non-existing key is reset
- Date: Thu, 15 Apr 2010 18:34:50 +0000 (UTC)
commit 8f23a01b5d8da15cac4f63f61c2ed1c58ff597f7
Author: Vincent Untz <vuntz gnome org>
Date: Thu Apr 15 14:32:57 2010 -0400
Do not send a changed signal when a non-existing key is reset
gio/gmemorysettingsbackend.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gio/gmemorysettingsbackend.c b/gio/gmemorysettingsbackend.c
index 15dfb73..01fae9a 100644
--- a/gio/gmemorysettingsbackend.c
+++ b/gio/gmemorysettingsbackend.c
@@ -178,11 +178,14 @@ g_memory_settings_backend_reset_key (GMemorySettingsBackend *memory,
const gchar *key,
gpointer origin_tag)
{
+ gboolean had_key;
const gchar *slash;
const gchar *base_key;
gchar *path;
- g_hash_table_remove (memory->priv->table, key);
+ had_key = g_hash_table_lookup_extended (memory->priv->table, key, NULL, NULL);
+ if (had_key)
+ g_hash_table_remove (memory->priv->table, key);
slash = strrchr (key, '/');
g_assert (slash != NULL);
@@ -194,7 +197,8 @@ g_memory_settings_backend_reset_key (GMemorySettingsBackend *memory,
g_free (path);
- g_settings_backend_changed (G_SETTINGS_BACKEND (memory), key, origin_tag);
+ if (had_key)
+ g_settings_backend_changed (G_SETTINGS_BACKEND (memory), key, origin_tag);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]