[dconf] engine: bring back origin_tag logic



commit 301f6cdda6e3ca520cbe4bb568c7922f39ff8887
Author: Ryan Lortie <desrt desrt ca>
Date:   Sun Jul 15 12:31:33 2012 -0400

    engine: bring back origin_tag logic
    
    The GSettings backend still wants to use this and it does us no harm to
    have it on the engine API (which is only visible internally).
    
    Adjust the various consumers of the engine to the new API.
    
    Thanks to Rui Matos for reminding me about this...

 client/dconf-client.c            |    5 +++--
 dbus-1/dconf-dbus-1.c            |    3 ++-
 engine/dconf-engine.c            |   14 ++++++++------
 engine/dconf-engine.h            |    2 ++
 gsettings/dconfsettingsbackend.c |   11 ++++++-----
 tests/engine.c                   |    1 +
 6 files changed, 22 insertions(+), 14 deletions(-)
---
diff --git a/client/dconf-client.c b/client/dconf-client.c
index 7a2a96c..ca84670 100644
--- a/client/dconf-client.c
+++ b/client/dconf-client.c
@@ -164,6 +164,7 @@ dconf_engine_change_notify (DConfEngine         *engine,
                             const gchar         *prefix,
                             const gchar * const *changes,
                             const gchar *        tag,
+                            gpointer             origin_tag,
                             gpointer             user_data)
 {
   GWeakRef *weak_ref = user_data;
@@ -332,7 +333,7 @@ dconf_client_write_fast (DConfClient  *client,
   g_return_val_if_fail (DCONF_IS_CLIENT (client), FALSE);
 
   changeset = dconf_changeset_new_write (key, value);
-  success = dconf_engine_change_fast (client->engine, changeset, error);
+  success = dconf_engine_change_fast (client->engine, changeset, NULL, error);
   dconf_changeset_unref (changeset);
 
   return success;
@@ -417,7 +418,7 @@ dconf_client_change_fast (DConfClient     *client,
 {
   g_return_val_if_fail (DCONF_IS_CLIENT (client), FALSE);
 
-  return dconf_engine_change_fast (client->engine, changeset, error);
+  return dconf_engine_change_fast (client->engine, changeset, NULL, error);
 }
 
 /**
diff --git a/dbus-1/dconf-dbus-1.c b/dbus-1/dconf-dbus-1.c
index bbc8b77..9bf39ff 100644
--- a/dbus-1/dconf-dbus-1.c
+++ b/dbus-1/dconf-dbus-1.c
@@ -43,6 +43,7 @@ dconf_engine_change_notify (DConfEngine         *engine,
                             const gchar         *prefix,
                             const gchar * const *changes,
                             const gchar         *tag,
+                            gpointer             origin_tag,
                             gpointer             user_data)
 {
   DConfDBusClient *dcdbc = user_data;
@@ -86,7 +87,7 @@ dconf_dbus_client_write (DConfDBusClient *dcdbc,
   gboolean success;
 
   changeset = dconf_changeset_new_write (key, value);
-  success = dconf_engine_change_fast (dcdbc->engine, changeset, NULL);
+  success = dconf_engine_change_fast (dcdbc->engine, changeset, NULL, NULL);
   dconf_changeset_unref (changeset);
 
   return success;
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index 9c80d9b..b1c0dd3 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -729,7 +729,7 @@ dconf_engine_watch_established (DConfEngine  *engine,
        * We don't know what changed, so we can just say that potentially
        * everything changed.  This case is very rare, anyway...
        */
-      dconf_engine_change_notify (engine, "/", changes, NULL, engine->user_data);
+      dconf_engine_change_notify (engine, "/", changes, NULL, NULL, engine->user_data);
     }
 
   dconf_engine_call_handle_free (handle);
@@ -858,13 +858,14 @@ static void dconf_engine_manage_queue (DConfEngine *engine);
 
 static void
 dconf_engine_emit_changes (DConfEngine    *engine,
-                           DConfChangeset *changeset)
+                           DConfChangeset *changeset,
+                           gpointer        origin_tag)
 {
   const gchar *prefix;
   const gchar * const *changes;
 
   if (dconf_changeset_describe (changeset, &prefix, &changes, NULL))
-    dconf_engine_change_notify (engine, prefix, changes, NULL, engine->user_data);
+    dconf_engine_change_notify (engine, prefix, changes, NULL, origin_tag, engine->user_data);
 }
 
 static void
@@ -924,7 +925,7 @@ dconf_engine_change_completed (DConfEngine  *engine,
        * message as a warning.
        */
       g_warning ("failed to commit changes to dconf: %s", error->message);
-      dconf_engine_emit_changes (engine, oc->change);
+      dconf_engine_emit_changes (engine, oc->change, NULL);
     }
 
   dconf_changeset_unref (oc->change);
@@ -1003,6 +1004,7 @@ dconf_engine_changeset_changes_only_writable_keys (DConfEngine    *engine,
 gboolean
 dconf_engine_change_fast (DConfEngine     *engine,
                           DConfChangeset  *changeset,
+                          gpointer         origin_tag,
                           GError         **error)
 {
   GList *node;
@@ -1056,7 +1058,7 @@ dconf_engine_change_fast (DConfEngine     *engine,
   dconf_engine_unlock_queues (engine);
 
   /* Emit the signal after dropping the lock to avoid deadlock on re-entry. */
-  dconf_engine_emit_changes (engine, changeset);
+  dconf_engine_emit_changes (engine, changeset, origin_tag);
 
   return TRUE;
 }
@@ -1124,7 +1126,7 @@ dconf_engine_handle_dbus_signal (GBusType     type,
            * Check last_handled to determine if we should ignore it.
            */
           if (!engine->last_handled || !g_str_equal (engine->last_handled, tag))
-            dconf_engine_change_notify (engine, prefix, changes, tag, engine->user_data);
+            dconf_engine_change_notify (engine, prefix, changes, tag, NULL, engine->user_data);
 
           engines = g_slist_delete_link (engines, engines);
 
diff --git a/engine/dconf-engine.h b/engine/dconf-engine.h
index 0128f8b..3c65e87 100644
--- a/engine/dconf-engine.h
+++ b/engine/dconf-engine.h
@@ -86,6 +86,7 @@ void                    dconf_engine_change_notify                      (DConfEn
                                                                          const gchar             *prefix,
                                                                          const gchar * const     *changes,
                                                                          const gchar             *tag,
+                                                                         gpointer                 origin_tag,
                                                                          gpointer                 user_data);
 
 /* These functions are implemented by the engine */
@@ -140,6 +141,7 @@ void                    dconf_engine_unwatch_fast                       (DConfEn
 G_GNUC_INTERNAL
 gboolean                dconf_engine_change_fast                        (DConfEngine             *engine,
                                                                          DConfChangeset          *changeset,
+                                                                         gpointer                 origin_tag,
                                                                          GError                 **error);
 
 /* Synchronous API: all calls block until completed */
diff --git a/gsettings/dconfsettingsbackend.c b/gsettings/dconfsettingsbackend.c
index 11c123c..1725d16 100644
--- a/gsettings/dconfsettingsbackend.c
+++ b/gsettings/dconfsettingsbackend.c
@@ -63,7 +63,7 @@ dconf_settings_backend_write (GSettingsBackend *backend,
   change = dconf_changeset_new ();
   dconf_changeset_set (change, key, value);
 
-  success = dconf_engine_change_fast (dcsb->engine, change, NULL);
+  success = dconf_engine_change_fast (dcsb->engine, change, origin_tag, NULL);
   dconf_changeset_unref (change);
 
   return success;
@@ -91,7 +91,7 @@ dconf_settings_backend_write_tree (GSettingsBackend *backend,
   change= dconf_changeset_new ();
   g_tree_foreach (tree, dconf_settings_backend_add_to_changeset, change);
 
-  success = dconf_engine_change_fast (dcsb->engine, change, NULL);
+  success = dconf_engine_change_fast (dcsb->engine, change, origin_tag, NULL);
   dconf_changeset_unref (change);
 
   return success;
@@ -213,6 +213,7 @@ dconf_engine_change_notify (DConfEngine         *engine,
                             const gchar         *prefix,
                             const gchar * const *changes,
                             const gchar         *tag,
+                            gpointer             origin_tag,
                             gpointer             user_data)
 {
   GWeakRef *weak_ref = user_data;
@@ -229,10 +230,10 @@ dconf_engine_change_notify (DConfEngine         *engine,
   if (changes[1] == NULL)
     {
       if (g_str_has_suffix (prefix, "/"))
-        g_settings_backend_path_changed (G_SETTINGS_BACKEND (dcsb), prefix, NULL);
+        g_settings_backend_path_changed (G_SETTINGS_BACKEND (dcsb), prefix, origin_tag);
       else
-        g_settings_backend_changed (G_SETTINGS_BACKEND (dcsb), prefix, NULL);
+        g_settings_backend_changed (G_SETTINGS_BACKEND (dcsb), prefix, origin_tag);
     }
   else
-    g_settings_backend_keys_changed (G_SETTINGS_BACKEND (dcsb), prefix, changes, NULL);
+    g_settings_backend_keys_changed (G_SETTINGS_BACKEND (dcsb), prefix, changes, origin_tag);
 }
diff --git a/tests/engine.c b/tests/engine.c
index 37a3e0f..7e4ea9c 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -37,6 +37,7 @@ dconf_engine_change_notify (DConfEngine         *engine,
                             const gchar         *prefix,
                             const gchar * const *changes,
                             const gchar         *tag,
+                            gpointer             origin_tag,
                             gpointer             user_data)
 {
   /* ignore */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]