[gconf] [client] Improve trace markers to say "CACHED" or "REMOTE"



commit 3e1a49e156b365f285c7b92798196ca3a7a04af5
Author: Behdad Esfahbod <behdad behdad org>
Date:   Tue Apr 21 03:00:35 2009 -0400

    [client] Improve trace markers to say "CACHED" or "REMOTE"
---
 gconf/gconf-client.c |   64 +++++++++++++++++++++++++------------------------
 1 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/gconf/gconf-client.c b/gconf/gconf-client.c
index cca0476..66a8c56 100644
--- a/gconf/gconf-client.c
+++ b/gconf/gconf-client.c
@@ -248,7 +248,7 @@ destroy_dir_foreach_remove(gpointer key, gpointer value, gpointer user_data)
   
   if (d->notify_id != 0)
     {
-      trace ("Removing notify ID %u from engine", d->notify_id);
+      trace ("REMOTED: Removing notify ID %u from engine", d->notify_id);
       PUSH_USE_ENGINE (client);
 	  gconf_engine_notify_remove (client->engine, d->notify_id);
       POP_USE_ENGINE (client);
@@ -563,7 +563,7 @@ gconf_client_add_dir     (GConfClient* client,
        */
       if (overlap_dir == NULL)
         {
-          trace ("Adding notify to engine at '%s'",
+          trace ("REMOTE: Adding notify to engine at '%s'",
                  dirname);
           PUSH_USE_ENGINE (client);
           notify_id = gconf_engine_notify_add (client->engine,
@@ -628,6 +628,8 @@ foreach_add_notifies(gpointer key, gpointer value, gpointer user_data)
        * already add a notify */
       if (overlap_dir == NULL)
         {
+          trace ("REMOTE: Adding notify to engine at '%s'",
+                 dir->name);
           PUSH_USE_ENGINE (client);
           dir->notify_id = gconf_engine_notify_add(client->engine,
                                                    dir->name,
@@ -687,7 +689,7 @@ gconf_client_real_remove_dir    (GConfClient* client,
   
   if (d->notify_id != 0)
     {
-      trace ("Removing notify from engine at '%s'", d->name);
+      trace ("REMOTE: Removing notify from engine at '%s'", d->name);
       PUSH_USE_ENGINE (client);
       gconf_engine_notify_remove (client->engine, d->notify_id);
       POP_USE_ENGINE (client);
@@ -845,6 +847,7 @@ recurse_subdir_list(GConfClient* client, GSList* subdirs)
       
       cache_pairs_in_dir(client, s);
 
+      trace ("REMOTE: All dirs at '%s'", s);
       PUSH_USE_ENGINE (client);
       recurse_subdir_list(client,
                           gconf_engine_all_dirs (client->engine, s, NULL));
@@ -918,7 +921,7 @@ cache_pairs_in_dir(GConfClient* client, const gchar* dir)
   GSList* pairs;
   GError* error = NULL;
 
-  trace ("Caching values in '%s'", dir);
+  trace ("REMOTE: Caching values in '%s'", dir);
   
   PUSH_USE_ENGINE (client);
   pairs = gconf_engine_all_entries(client->engine, dir, &error);
@@ -977,6 +980,7 @@ gconf_client_preload    (GConfClient* client,
 
         trace ("Recursive preload of '%s'", dirname);
         
+	trace ("REMOTE: All dirs at '%s'", dirname);
         PUSH_USE_ENGINE (client);
         subdirs = gconf_engine_all_dirs(client->engine, dirname, NULL);
         POP_USE_ENGINE (client);
@@ -1005,7 +1009,7 @@ gconf_client_set             (GConfClient* client,
 {
   GError* error = NULL;
 
-  trace ("Setting value of '%s'", key);
+  trace ("REMOTE: Setting value of '%s'", key);
   PUSH_USE_ENGINE (client);
   gconf_engine_set (client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1019,8 +1023,7 @@ gconf_client_unset          (GConfClient* client,
 {
   GError* error = NULL;
 
-  trace ("Unsetting '%s'", key);
-  
+  trace ("REMOTE: Unsetting '%s'", key);
   PUSH_USE_ENGINE (client);
   gconf_engine_unset(client->engine, key, &error);
   POP_USE_ENGINE (client);
@@ -1041,7 +1044,7 @@ gconf_client_recursive_unset (GConfClient *client,
 {
   GError* error = NULL;
 
-  trace ("Unsetting '%s'", key);
+  trace ("REMOTE: Recursive unsetting '%s'", key);
   
   PUSH_USE_ENGINE (client);
   gconf_engine_recursive_unset(client->engine, key, flags, &error);
@@ -1084,15 +1087,13 @@ gconf_client_all_entries    (GConfClient* client,
   GSList *retval;
   int dirlen;
 
-  trace ("Getting all values in '%s'", dir);
-
   if (g_hash_table_lookup (client->cache_dirs, dir))
     {
       GHashTableIter iter;
       gchar *key;
       GConfEntry *entry;
 
-      trace ("Using cached values");
+      trace ("CACHED: Getting all values in '%s'", dir);
 
       dirlen = strlen (dir);
       retval = NULL;
@@ -1107,6 +1108,8 @@ gconf_client_all_entries    (GConfClient* client,
       return retval;
     }
 
+  trace ("REMOTE: Getting all values in '%s'", dir);
+
   PUSH_USE_ENGINE (client);
   retval = gconf_engine_all_entries (client->engine, dir, &error);
   POP_USE_ENGINE (client);
@@ -1133,7 +1136,7 @@ gconf_client_all_dirs       (GConfClient* client,
   GError* error = NULL;
   GSList* retval;
 
-  trace ("Getting all dirs in '%s'", dir);
+  trace ("REMOTE: Getting all dirs in '%s'", dir);
   
   PUSH_USE_ENGINE (client);
   retval = gconf_engine_all_dirs(client->engine, dir, &error);
@@ -1150,7 +1153,7 @@ gconf_client_suggest_sync   (GConfClient* client,
 {
   GError* error = NULL;
 
-  trace ("Suggesting sync");
+  trace ("REMOTE: Suggesting sync");
   
   PUSH_USE_ENGINE (client);
   gconf_engine_suggest_sync(client->engine, &error);
@@ -1166,7 +1169,7 @@ gconf_client_dir_exists(GConfClient* client,
   GError* error = NULL;
   gboolean retval;
 
-  trace ("Checking whether directory '%s' exists...", dir);
+  trace ("REMOTE: Checking whether directory '%s' exists...", dir);
   
   PUSH_USE_ENGINE (client);
   retval = gconf_engine_dir_exists (client->engine, dir, &error);
@@ -1198,10 +1201,12 @@ gconf_client_key_is_writable (GConfClient* client,
     {
       g_assert (entry != NULL);
 
-      trace ("Checking in cache whether key '%s' is writable", key);
+      trace ("CACHED: Checking whether key '%s' is writable", key);
       return gconf_entry_get_is_writable (entry);
     }
   
+  trace ("REMOTE: Checking whether key '%s' is writable", key);
+
   entry = get (client, key, TRUE, &error);
 
   if (entry == NULL && error != NULL)
@@ -1209,8 +1214,6 @@ gconf_client_key_is_writable (GConfClient* client,
   else
     g_assert (error == NULL);
 
-  trace ("Checking whether key '%s' is writable...", key);
-
   if (entry == NULL)
     is_writable = FALSE;
   else
@@ -1255,7 +1258,7 @@ get (GConfClient *client,
   if (gconf_client_lookup (client, key, &entry))
 
     {
-      trace ("'%s' was in the client-side cache", key);
+      trace ("CACHED: Query for '%s'", key);
       
       if (entry == NULL)
         return NULL;
@@ -1269,7 +1272,7 @@ get (GConfClient *client,
   g_assert (entry == NULL); /* if it was in the cache we should have returned */
 
   /* Check the GConfEngine */
-  trace ("Doing remote query for '%s'", key);
+  trace ("REMOTE: Query for '%s'", key);
   PUSH_USE_ENGINE (client);
   entry = gconf_engine_get_entry (client->engine, key,
                                   gconf_current_locale(),
@@ -1397,8 +1400,6 @@ gconf_client_get_default_from_schema (GConfClient* client,
   g_return_val_if_fail (GCONF_IS_CLIENT(client), NULL);
   g_return_val_if_fail (key != NULL, NULL);
   
-  trace ("Getting default for '%s' from schema", key);
-  
   /* Check our client-side cache to see if the default is the same as
    * the regular value (FIXME put a default_value field in the
    * cache and store both, lose the is_default flag)
@@ -1406,10 +1407,11 @@ gconf_client_get_default_from_schema (GConfClient* client,
   if (gconf_client_lookup (client, key, &entry))
     {
       g_assert (entry != NULL);
-      
+
       if (gconf_entry_get_is_default (entry))
         {
-          trace ("Using cached value for schema default");
+	  trace ("CACHED: Getting schema default for '%s'", key);
+
           return gconf_entry_get_value (entry) ?
             gconf_value_copy (gconf_entry_get_value (entry)) :
             NULL;
@@ -1417,7 +1419,7 @@ gconf_client_get_default_from_schema (GConfClient* client,
     }
 
   /* Check the GConfEngine */
-  trace ("Asking engine for schema default");
+  trace ("REMOTE: Getting schema default for '%s'", key);
   PUSH_USE_ENGINE (client);
   val = gconf_engine_get_default_from_schema (client->engine, key,
                                               &error);
@@ -1717,7 +1719,7 @@ gconf_client_set_float   (GConfClient* client, const gchar* key,
   g_return_val_if_fail(GCONF_IS_CLIENT(client), FALSE);  
   g_return_val_if_fail(key != NULL, FALSE);
 
-  trace ("Setting float '%s'", key);
+  trace ("REMOTE: Setting float '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_float (client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1742,7 +1744,7 @@ gconf_client_set_int     (GConfClient* client, const gchar* key,
   g_return_val_if_fail(GCONF_IS_CLIENT(client), FALSE);  
   g_return_val_if_fail(key != NULL, FALSE);
 
-  trace ("Setting int '%s'", key);
+  trace ("REMOTE: Setting int '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_int (client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1768,7 +1770,7 @@ gconf_client_set_string  (GConfClient* client, const gchar* key,
   g_return_val_if_fail(key != NULL, FALSE);
   g_return_val_if_fail(val != NULL, FALSE);
 
-  trace ("Setting string '%s'", key);
+  trace ("REMOTE: Setting string '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_string(client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1793,7 +1795,7 @@ gconf_client_set_bool    (GConfClient* client, const gchar* key,
   g_return_val_if_fail(GCONF_IS_CLIENT(client), FALSE);  
   g_return_val_if_fail(key != NULL, FALSE);
 
-  trace ("Setting bool '%s'", key);
+  trace ("REMOTE: Setting bool '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_bool (client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1819,7 +1821,7 @@ gconf_client_set_schema  (GConfClient* client, const gchar* key,
   g_return_val_if_fail(key != NULL, FALSE);
   g_return_val_if_fail(val != NULL, FALSE);
 
-  trace ("Setting schema '%s'", key);
+  trace ("REMOTE: Setting schema '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_schema(client->engine, key, val, &error);
   POP_USE_ENGINE (client);
@@ -1846,7 +1848,7 @@ gconf_client_set_list    (GConfClient* client, const gchar* key,
   g_return_val_if_fail(GCONF_IS_CLIENT(client), FALSE);  
   g_return_val_if_fail(key != NULL, FALSE);
 
-  trace ("Setting list '%s'", key);
+  trace ("REMOTE: Setting list '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_list(client->engine, key, list_type, list, &error);
   POP_USE_ENGINE (client);
@@ -1874,7 +1876,7 @@ gconf_client_set_pair    (GConfClient* client, const gchar* key,
   g_return_val_if_fail(GCONF_IS_CLIENT(client), FALSE);  
   g_return_val_if_fail(key != NULL, FALSE);
 
-  trace ("Setting pair '%s'", key);
+  trace ("REMOTE: Setting pair '%s'", key);
   PUSH_USE_ENGINE (client);
   result = gconf_engine_set_pair (client->engine, key, car_type, cdr_type,
                                   address_of_car, address_of_cdr, &error);



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