Commit 118ae129 authored by Allison Karlitskaya's avatar Allison Karlitskaya

GDelayedSettingsBackend: another mandatory fixup

  - emit the "has-unapplied" property notify if dropping the last key
    from the changeset due to a mandatory key
parent e06e441a
......@@ -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,20 +287,30 @@ delayed_backend_path_writable_changed (GSettingsBackend *backend,
gpointer user_data)
{
GDelayedSettingsBackend *delayed = G_DELAYED_SETTINGS_BACKEND (user_data);
CheckPrefixState state = { path, };
gsize i;
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) */
g_tree_foreach (delayed->priv->delayed, check_prefix, &state);
/* 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 */
for (i = 0; i < state.index; i++)
if (!g_settings_backend_get_writable (delayed->priv->backend,
state.keys[i]))
g_tree_remove (delayed->priv->delayed, state.keys[i]);
/* drop the keys that have been affected */
for (i = 0; i < state.index; i++)
if (!g_settings_backend_get_writable (delayed->priv->backend,
state.keys[i]))
g_tree_remove (delayed->priv->delayed, state.keys[i]);
g_free (state.keys);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment