Commit 4efd3746 authored by Philip Withnall's avatar Philip Withnall
Browse files

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

parent 85e8d88f
...@@ -496,39 +496,33 @@ public class Tpf.Persona : Folks.Persona, ...@@ -496,39 +496,33 @@ public class Tpf.Persona : Folks.Persona,
} }
/* Note: Only ever called as a result of signals from Telepathy. */ /* 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; 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) if (changed == true)
{ {
this.group_changed (group, is_member);
this.notify_property ("groups"); 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);
}
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment