GDelayedSettingsBackend: another mandatory fixup

- emit the "has-unapplied" property notify if dropping the last key
    from the changeset due to a mandatory key
This commit is contained in:
Ryan Lortie 2010-04-17 11:58:52 -04:00
parent e06e441ac2
commit 118ae129bc

View File

@ -249,6 +249,11 @@ delayed_backend_writable_changed (GSettingsBackend *backend,
* no need to signal this since the writable change implies it.
*/
g_tree_remove (delayed->priv->delayed, key);
/* if that was the only key... */
if (delayed->priv->owner &&
g_tree_nnodes (delayed->priv->delayed) == 0)
g_object_notify (delayed->priv->owner, "has-unapplied");
}
g_settings_backend_writable_changed (G_SETTINGS_BACKEND (delayed), key);
@ -282,11 +287,16 @@ delayed_backend_path_writable_changed (GSettingsBackend *backend,
gpointer user_data)
{
GDelayedSettingsBackend *delayed = G_DELAYED_SETTINGS_BACKEND (user_data);
CheckPrefixState state = { path, };
gsize n_keys;
n_keys = g_tree_nnodes (delayed->priv->delayed);
if (n_keys > 0)
{
CheckPrefixState state = { path, g_new (const gchar *, n_keys) };
gsize i;
/* collect a list of possibly-affected keys (ie: matching the path) */
state.keys = g_new (const gchar *, g_tree_nnodes (delayed->priv->delayed));
g_tree_foreach (delayed->priv->delayed, check_prefix, &state);
/* drop the keys that have been affected */
@ -297,6 +307,11 @@ delayed_backend_path_writable_changed (GSettingsBackend *backend,
g_free (state.keys);
if (delayed->priv->owner &&
g_tree_nnodes (delayed->priv->delayed) == 0)
g_object_notify (delayed->priv->owner, "has-unapplied");
}
g_settings_backend_path_writable_changed (G_SETTINGS_BACKEND (delayed),
path);
}