[folks] telepathy: Tidy up group change notification handling in Tpf.Persona



commit 4efd37460b929233404dc84e6923611f901e7aac
Author: Philip Withnall <philip tecnocode co uk>
Date:   Fri Jul 13 23:17:33 2012 +0100

    telepathy: Tidy up group change notification handling in Tpf.Persona

 backends/telepathy/lib/tpf-persona.vala |   36 +++++++++++++------------------
 1 files changed, 15 insertions(+), 21 deletions(-)
---
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index 8134d52..234621b 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -496,39 +496,33 @@ public class Tpf.Persona : Folks.Persona,
     }
 
   /* Note: Only ever called as a result of signals from Telepathy. */
-  private bool _change_group (string group, bool is_member)
+  private void _contact_groups_changed (string[] added, string[] removed)
     {
       var changed = false;
 
-      if (is_member)
+      foreach (var group in added)
         {
-          changed = this._groups.add (group);
+          if (this._groups.add (group) == true)
+            {
+              changed = true;
+              this.group_changed (group, true);
+            }
         }
-      else
+
+      foreach (var group in removed)
         {
-          changed = this._groups.remove (group);
+          if (this._groups.remove (group) == true)
+            {
+              changed = true;
+              this.group_changed (group, false);
+            }
         }
 
+      /* Notify if anything changed. */
       if (changed == true)
         {
-          this.group_changed (group, is_member);
           this.notify_property ("groups");
         }
-
-      return changed;
-    }
-
-  private void _contact_groups_changed (string[] added, string[] removed)
-    {
-      foreach (var group in added)
-        {
-          this._change_group (group, true);
-        }
-
-      foreach (var group in removed)
-        {
-          this._change_group (group, false);
-        }
     }
 
   /**



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