private Logger logger;
private Contact self_contact;
private MaybeBool _can_add_personas = MaybeBool.UNSET;
+ private MaybeBool _can_remove_personas = MaybeBool.UNSET;
private bool _is_prepared = false;
internal signal void group_members_changed (string group,
}
/**
+ * Whether this PersonaStore can remove {@link Folks.Persona}s.
+ *
+ * See {@link Folks.PersonaStore.can_remove_personas}.
+ *
+ * @since 0.3.1
+ */
+ public override MaybeBool can_remove_personas
+ {
+ get { return this._can_remove_personas; }
+ }
+
+ /**
* Whether this PersonaStore has been prepared.
*
* See {@link Folks.PersonaStore.is_prepared}.
this.update_capability ((ChannelGroupFlags) added,
(ChannelGroupFlags) removed, ChannelGroupFlags.CAN_ADD,
ref this._can_add_personas, "can-add-personas");
+
+ this.update_capability ((ChannelGroupFlags) added,
+ (ChannelGroupFlags) removed, ChannelGroupFlags.CAN_REMOVE,
+ ref this._can_remove_personas, "can-remove-personas");
}
private void update_capability (
private MainLoop main_loop;
private string bus_name;
private string object_path;
- private bool got_group_flags;
+ private HashSet<string> group_flags_received;
public PersonaStoreCapabilitiesTests ()
{
public override void set_up ()
{
- this.got_group_flags = false;
+ this.group_flags_received = new HashSet<string> (str_hash, str_equal);
this.main_loop = new GLib.MainLoop (null, false);
main_loop.run ();
- assert (this.got_group_flags);
+ assert (this.group_flags_received.contains ("can-add-personas"));
+ assert (this.group_flags_received.contains ("can-remove-personas"));
}
private void set_up_persona_store (Folks.PersonaStore store)
else
store.notify["can-add-personas"].connect (
this.can_add_personas_cb);
+
+ if (store.can_remove_personas != MaybeBool.UNSET)
+ can_remove_personas_cb (store, null);
+ else
+ store.notify["can-remove-personas"].connect (
+ this.can_remove_personas_cb);
}
catch (GLib.Error e)
{
{
assert (store.can_add_personas == MaybeBool.TRUE);
- this.got_group_flags = true;
+ this.group_flags_received.add ("can-add-personas");
store.notify["can-add-personas"].disconnect (
this.can_add_personas_cb);
}
}
+
+ private void can_remove_personas_cb (GLib.Object s, ParamSpec? p)
+ {
+ assert (s is Tpf.PersonaStore);
+ var store = (Tpf.PersonaStore) s;
+
+ if (store.can_remove_personas != MaybeBool.UNSET)
+ {
+ assert (store.can_remove_personas == MaybeBool.TRUE);
+
+ this.group_flags_received.add ("can-remove-personas");
+
+ store.notify["can-remove-personas"].disconnect (
+ this.can_remove_personas_cb);
+ }
+ }
}
public int main (string[] args)