GSettingsBackend: drop the concept of 'origin_tag'

This was only used by the (now removed) delayed settings backend.
This commit is contained in:
Ryan Lortie
2011-12-30 00:54:57 -05:00
parent 3ea81c6adb
commit 55005057d2
8 changed files with 34 additions and 72 deletions

View File

@@ -265,8 +265,7 @@ g_keyfile_settings_backend_read (GSettingsBackend *backend,
static gboolean
g_keyfile_settings_backend_write (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag)
GVariant *value)
{
GKeyfileSettingsBackend *kfsb = G_KEYFILE_SETTINGS_BACKEND (backend);
gboolean success;
@@ -278,7 +277,7 @@ g_keyfile_settings_backend_write (GSettingsBackend *backend,
if (success)
{
g_settings_backend_changed (backend, key, origin_tag);
g_settings_backend_changed (backend, key);
g_keyfile_settings_backend_keyfile_write (kfsb);
}
@@ -287,15 +286,14 @@ g_keyfile_settings_backend_write (GSettingsBackend *backend,
static void
g_keyfile_settings_backend_reset (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag)
const gchar *key)
{
GKeyfileSettingsBackend *kfsb = G_KEYFILE_SETTINGS_BACKEND (backend);
if (set_to_keyfile (kfsb, key, NULL))
g_keyfile_settings_backend_keyfile_write (kfsb);
g_settings_backend_changed (backend, key, origin_tag);
g_settings_backend_changed (backend, key);
}
static gboolean
@@ -407,7 +405,7 @@ g_keyfile_settings_backend_keyfile_reload (GKeyfileSettingsBackend *kfsb)
kfsb->keyfile = keyfiles[1];
if (g_tree_nnodes (tree) > 0)
g_settings_backend_changed_tree (&kfsb->parent_instance, tree, NULL);
g_settings_backend_changed_tree (&kfsb->parent_instance, tree);
g_tree_unref (tree);

View File

@@ -67,8 +67,7 @@ g_memory_settings_backend_read (GSettingsBackend *backend,
static gboolean
g_memory_settings_backend_write (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag)
GVariant *value)
{
GMemorySettingsBackend *memory = G_MEMORY_SETTINGS_BACKEND (backend);
GVariant *old_value;
@@ -79,7 +78,7 @@ g_memory_settings_backend_write (GSettingsBackend *backend,
if (old_value == NULL || !g_variant_equal (value, old_value))
{
g_hash_table_insert (memory->table, g_strdup (key), value);
g_settings_backend_changed (backend, key, origin_tag);
g_settings_backend_changed (backend, key);
}
else
g_variant_unref (value);
@@ -89,15 +88,14 @@ g_memory_settings_backend_write (GSettingsBackend *backend,
static void
g_memory_settings_backend_reset (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag)
const gchar *key)
{
GMemorySettingsBackend *memory = G_MEMORY_SETTINGS_BACKEND (backend);
if (g_hash_table_lookup (memory->table, key))
{
g_hash_table_remove (memory->table, key);
g_settings_backend_changed (backend, key, origin_tag);
g_settings_backend_changed (backend, key);
}
}

View File

@@ -53,8 +53,7 @@ g_null_settings_backend_read (GSettingsBackend *backend,
static gboolean
g_null_settings_backend_write (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag)
GVariant *value)
{
if (value)
g_variant_unref (g_variant_ref_sink (value));
@@ -63,8 +62,7 @@ g_null_settings_backend_write (GSettingsBackend *backend,
static void
g_null_settings_backend_reset (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag)
const gchar *key)
{
}

View File

@@ -1007,8 +1007,7 @@ g_registry_backend_write_one (const char *key_name,
static gboolean
g_registry_backend_write (GSettingsBackend *backend,
const gchar *key_name,
GVariant *value,
gpointer origin_tag)
GVariant *value)
{
GRegistryBackend *self = G_REGISTRY_BACKEND (backend);
LONG result;
@@ -1025,7 +1024,7 @@ g_registry_backend_write (GSettingsBackend *backend,
action.self = self;
action.hroot = hroot;
g_registry_backend_write_one (key_name, value, &action);
g_settings_backend_changed (backend, key_name, origin_tag);
g_settings_backend_changed (backend, key_name);
RegCloseKey (hroot);
@@ -1034,8 +1033,7 @@ g_registry_backend_write (GSettingsBackend *backend,
static void
g_registry_backend_reset (GSettingsBackend *backend,
const gchar *key_name,
gpointer origin_tag)
const gchar *key_name)
{
GRegistryBackend *self = G_REGISTRY_BACKEND (backend);
gchar *path_name, *value_name = NULL;
@@ -1074,7 +1072,7 @@ g_registry_backend_reset (GSettingsBackend *backend,
g_free (path_name);
g_settings_backend_changed (backend, key_name, origin_tag);
g_settings_backend_changed (backend, key_name);
}
/* Not implemented and probably beyond the scope of this backend */

View File

@@ -1090,7 +1090,7 @@ g_settings_write_to_backend (GSettings *settings,
gchar *path;
path = g_strconcat (settings->priv->path, key->name, NULL);
success = g_settings_backend_write (settings->priv->backend, path, value, NULL);
success = g_settings_backend_write (settings->priv->backend, path, value);
g_free (path);
return success;
@@ -2050,7 +2050,7 @@ g_settings_reset (GSettings *settings,
gchar *path;
path = g_strconcat (settings->priv->path, key, NULL);
g_settings_backend_reset (settings->priv->backend, path, NULL);
g_settings_backend_reset (settings->priv->backend, path);
g_free (path);
}

View File

@@ -144,7 +144,6 @@ g_settings_backend_event (GSettingsBackend *backend,
* g_settings_backend_changed:
* @backend: a #GSettingsBackend implementation
* @key: the name of the key
* @origin_tag: the origin tag
*
* Signals that a single key has possibly changed. Backend
* implementations should call this if a key has possibly changed its
@@ -165,16 +164,11 @@ g_settings_backend_event (GSettingsBackend *backend,
* in response to any other action (including from calls to
* g_settings_backend_write()).
*
* In the case that this call is in response to a call to
* g_settings_backend_write() then @origin_tag must be set to the same
* value that was passed to that call.
*
* Since: 2.26
**/
void
g_settings_backend_changed (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag)
const gchar *key)
{
GSettingsEvent event;
gchar *null = NULL;
@@ -185,7 +179,6 @@ g_settings_backend_changed (GSettingsBackend *backend,
event.type = G_SETTINGS_EVENT_CHANGE;
event.prefix = (gchar *) key;
event.keys = &null;
event.origin_tag = origin_tag;
g_settings_backend_event (backend, &event);
}
@@ -195,7 +188,6 @@ g_settings_backend_changed (GSettingsBackend *backend,
* @backend: a #GSettingsBackend implementation
* @path: the path containing the changes
* @items: (array zero-terminated=1): the %NULL-terminated list of changed keys
* @origin_tag: the origin tag
*
* Signals that a list of keys have possibly changed. Backend
* implementations should call this if keys have possibly changed their
@@ -224,8 +216,7 @@ g_settings_backend_changed (GSettingsBackend *backend,
void
g_settings_backend_keys_changed (GSettingsBackend *backend,
const gchar *path,
gchar const * const *items,
gpointer origin_tag)
gchar const * const *items)
{
GSettingsEvent event;
@@ -238,7 +229,6 @@ g_settings_backend_keys_changed (GSettingsBackend *backend,
event.type = G_SETTINGS_EVENT_CHANGE;
event.prefix = (gchar *) path;
event.keys = (gchar **) items;
event.origin_tag = origin_tag;
g_settings_backend_event (backend, &event);
}
@@ -247,7 +237,6 @@ g_settings_backend_keys_changed (GSettingsBackend *backend,
* g_settings_backend_path_changed:
* @backend: a #GSettingsBackend implementation
* @path: the path containing the changes
* @origin_tag: the origin tag
*
* Signals that all keys below a given path may have possibly changed.
* Backend implementations should call this if an entire path of keys
@@ -275,8 +264,7 @@ g_settings_backend_keys_changed (GSettingsBackend *backend,
*/
void
g_settings_backend_path_changed (GSettingsBackend *backend,
const gchar *path,
gpointer origin_tag)
const gchar *path)
{
GSettingsEvent event;
gchar *null = NULL;
@@ -287,7 +275,6 @@ g_settings_backend_path_changed (GSettingsBackend *backend,
event.type = G_SETTINGS_EVENT_CHANGE;
event.prefix = (gchar *) path;
event.keys = &null;
event.origin_tag = origin_tag;
g_settings_backend_event (backend, &event);
}
@@ -317,7 +304,6 @@ g_settings_backend_writable_changed (GSettingsBackend *backend,
event.type = G_SETTINGS_EVENT_WRITABLE_CHANGE;
event.prefix = (gchar *) key;
event.keys = &null;
event.origin_tag = NULL;
g_settings_backend_event (backend, &event);
}
@@ -348,7 +334,6 @@ g_settings_backend_path_writable_changed (GSettingsBackend *backend,
event.type = G_SETTINGS_EVENT_WRITABLE_CHANGE;
event.prefix = (gchar *) path;
event.keys = &null;
event.origin_tag = NULL;
g_settings_backend_event (backend, &event);
}
@@ -466,7 +451,6 @@ g_settings_backend_flatten_tree (GTree *tree,
* g_settings_backend_changed_tree:
* @backend: a #GSettingsBackend implementation
* @tree: a #GTree containing the changes
* @origin_tag: the origin tag
*
* This call is a convenience wrapper. It gets the list of changes from
* @tree, computes the longest common prefix and calls
@@ -476,8 +460,7 @@ g_settings_backend_flatten_tree (GTree *tree,
**/
void
g_settings_backend_changed_tree (GSettingsBackend *backend,
GTree *tree,
gpointer origin_tag)
GTree *tree)
{
const gchar **keys;
gchar *path;
@@ -498,7 +481,7 @@ g_settings_backend_changed_tree (GSettingsBackend *backend,
}
#endif
g_settings_backend_keys_changed (backend, path, keys, origin_tag);
g_settings_backend_keys_changed (backend, path, keys);
g_free (path);
g_free (keys);
}
@@ -553,7 +536,6 @@ g_settings_backend_read (GSettingsBackend *backend,
* @backend: a #GSettingsBackend implementation
* @key: the name of the key
* @value: a #GVariant value to write to this key
* @origin_tag: the origin tag
*
* Writes exactly one key.
*
@@ -572,14 +554,13 @@ g_settings_backend_read (GSettingsBackend *backend,
gboolean
g_settings_backend_write (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag)
GVariant *value)
{
gboolean success;
g_variant_ref_sink (value);
success = G_SETTINGS_BACKEND_GET_CLASS (backend)
->write (backend, key, value, origin_tag);
->write (backend, key, value);
g_variant_unref (value);
return success;
@@ -589,7 +570,6 @@ g_settings_backend_write (GSettingsBackend *backend,
* g_settings_backend_reset:
* @backend: a #GSettingsBackend implementation
* @key: the name of a key
* @origin_tag: the origin tag
*
* "Resets" the named key to its "default" value (ie: after system-wide
* defaults, mandatory keys, etc. have been taken into account) or possibly
@@ -597,11 +577,10 @@ g_settings_backend_write (GSettingsBackend *backend,
*/
void
g_settings_backend_reset (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag)
const gchar *key)
{
G_SETTINGS_BACKEND_GET_CLASS (backend)
->reset (backend, key, origin_tag);
->reset (backend, key);
}
/*< private >

View File

@@ -75,11 +75,9 @@ struct _GSettingsBackendClass
gboolean (* write) (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag);
GVariant *value);
void (* reset) (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag);
const gchar *key);
void (* subscribe) (GSettingsBackend *backend,
const gchar *name);
@@ -116,7 +114,6 @@ typedef struct
GSettingsEventType type;
gchar *prefix;
gchar **keys;
gpointer origin_tag;
} GSettingsEvent;
GType g_settings_backend_get_type (void);
@@ -126,27 +123,23 @@ void g_settings_backend_event (GSettin
void g_settings_backend_set_has_unapplied (GSettingsBackend *backend,
gboolean has_unapplied);
void g_settings_backend_changed (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag);
const gchar *key);
void g_settings_backend_path_changed (GSettingsBackend *backend,
const gchar *path,
gpointer origin_tag);
const gchar *path);
void g_settings_backend_flatten_tree (GTree *tree,
gchar **path,
const gchar ***keys,
GVariant ***values);
void g_settings_backend_keys_changed (GSettingsBackend *backend,
const gchar *path,
gchar const * const *items,
gpointer origin_tag);
gchar const * const *items);
void g_settings_backend_path_writable_changed (GSettingsBackend *backend,
const gchar *path);
void g_settings_backend_writable_changed (GSettingsBackend *backend,
const gchar *key);
void g_settings_backend_changed_tree (GSettingsBackend *backend,
GTree *tree,
gpointer origin_tag);
GTree *tree);
GSettingsBackend * g_settings_backend_get_default (void);

View File

@@ -48,12 +48,10 @@ GVariant * g_settings_backend_read (GSettin
G_GNUC_INTERNAL
gboolean g_settings_backend_write (GSettingsBackend *backend,
const gchar *key,
GVariant *value,
gpointer origin_tag);
GVariant *value);
G_GNUC_INTERNAL
void g_settings_backend_reset (GSettingsBackend *backend,
const gchar *key,
gpointer origin_tag);
const gchar *key);
G_GNUC_INTERNAL
gboolean g_settings_backend_get_writable (GSettingsBackend *backend,
const char *key);