[folks] Add more debugging for aliases



commit c2c799bd5bd39de40ef17cdaa7050b6837b088ac
Author: Philip Withnall <philip withnall collabora co uk>
Date:   Wed Sep 8 10:39:47 2010 +0100

    Add more debugging for aliases

 backends/key-file/kf-persona.vala |    3 +++
 folks/individual.vala             |   18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/backends/key-file/kf-persona.vala b/backends/key-file/kf-persona.vala
index bfb669d..66432ab 100644
--- a/backends/key-file/kf-persona.vala
+++ b/backends/key-file/kf-persona.vala
@@ -51,6 +51,8 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
           if (this._alias == value)
             return;
 
+          debug ("Setting alias of Kf.Persona '%s' to '%s'.", this.uid, value);
+
           this._alias = value;
           this.key_file.set_string (this.display_id, "__alias", value);
 
@@ -136,6 +138,7 @@ public class Folks.Backends.Kf.Persona : Folks.Persona,
               if (key == "__alias")
                 {
                   this._alias = this.key_file.get_string (this.display_id, key);
+                  debug ("    Loaded alias '%s'.", this._alias);
                   continue;
                 }
 
diff --git a/folks/individual.vala b/folks/individual.vala
index d20bc3d..9294ef4 100644
--- a/folks/individual.vala
+++ b/folks/individual.vala
@@ -150,12 +150,16 @@ public class Folks.Individual : Object,
 
           this._alias = value;
 
+          debug ("Setting alias of individual '%s' to '%s'â?¦", this.id, value);
+
           /* First, try to write it to only the writeable Personasâ?¦ */
           bool alias_changed = false;
           this._persona_list.foreach ((p) =>
             {
               if (p is Alias && ((Persona) p).store.is_writeable == true)
                 {
+                  debug ("    written to writeable persona '%s'",
+                      ((Persona) p).uid);
                   ((Alias) p).alias = value;
                   alias_changed = true;
                 }
@@ -168,7 +172,11 @@ public class Folks.Individual : Object,
               this._persona_list.foreach ((p) =>
                 {
                   if (p is Alias)
-                    ((Alias) p).alias = value;
+                    {
+                      debug ("    written to non-writeable persona '%s'",
+                          ((Persona) p).uid);
+                      ((Alias) p).alias = value;
+                    }
                 });
             }
         }
@@ -510,6 +518,8 @@ public class Folks.Individual : Object,
       string alias = null;
       bool alias_is_display_id = false;
 
+      debug ("Updating alias for individual '%s'", this.id);
+
       /* Search for an alias from a writeable Persona, and use it as our first
        * choice if it's non-empty, since that's where the user-set alias is
        * stored. */
@@ -527,6 +537,8 @@ public class Folks.Individual : Object,
             }
         }
 
+      debug ("    got alias '%s' from writeable personas", alias);
+
       /* Since we can't find a non-empty alias from a writeable backend, try
        * the aliases from other personas. Use a non-empty alias which isn't
        * equal to the persona's display ID as our preference. If we can't find
@@ -560,6 +572,8 @@ public class Folks.Individual : Object,
             }
         }
 
+      debug ("    got alias '%s' from non-writeable personas", alias);
+
       if (alias == null)
         {
           /* We have to pick a display ID, since none of the personas have an
@@ -576,6 +590,8 @@ public class Folks.Individual : Object,
        * something else undesirable. */
       if (this._alias != alias)
         {
+          debug ("Changing alias of individual '%s' from '%s' to '%s'.",
+              this.id, this._alias, alias);
           this._alias = alias;
           this.notify_property ("alias");
         }



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