diff options
author | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-05-02 17:24:58 +0200 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.co.uk> | 2012-05-03 10:34:29 +0200 |
commit | aa611fb0084b0c94f5e3b3c9c7e5ae30b8556c67 (patch) | |
tree | ec0bad40258d848c52c798cb805f87f768906e1f /telepathy-glib/contact.c | |
parent | 4a0739c2a00b833fdc3a312680686a87c49258a0 (diff) | |
download | telepathy-glib-aa611fb0084b0c94f5e3b3c9c7e5ae30b8556c67.tar.gz |
Add tp_contact_is_self()
Diffstat (limited to 'telepathy-glib/contact.c')
-rw-r--r-- | telepathy-glib/contact.c | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index 1c7a00ef6..352113722 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -184,6 +184,7 @@ enum { PROP_PUBLISH_REQUEST, PROP_CONTACT_GROUPS, PROP_IS_BLOCKED, + PROP_IS_SELF, N_PROPS }; @@ -218,6 +219,7 @@ struct _TpContactPrivate { TpHandle handle; gchar *identifier; ContactFeatureFlags has_features; + gboolean is_self; /* aliasing */ gchar *alias; @@ -369,6 +371,33 @@ tp_contact_has_feature (TpContact *self, return ((self->priv->has_features & (1 << feature)) != 0); } +/** + * tp_contact_is_self: + * @self: a contact + * + * <!-- --> + * + * Returns: the value of #TpContact:is-self property + * Since: 0.UNRELEASED + */ +gboolean +tp_contact_is_self (TpContact *self) +{ + g_return_val_if_fail (TP_IS_CONTACT (self), FALSE); + + return self->priv->is_self; +} + +void +_tp_contact_set_is_self (TpContact *self, + gboolean is_self) +{ + g_return_if_fail (TP_IS_CONTACT (self)); + + self->priv->is_self = is_self; + g_object_notify ((GObject *) self, "is-self"); +} + /** * tp_contact_get_alias: @@ -956,6 +985,10 @@ tp_contact_get_property (GObject *object, g_value_set_boolean (value, tp_contact_is_blocked (self)); break; + case PROP_IS_SELF: + g_value_set_boolean (value, tp_contact_is_self (self)); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -1331,7 +1364,7 @@ tp_contact_class_init (TpContactClass *klass) g_object_class_install_property (object_class, PROP_CONTACT_GROUPS, param_spec); -/** + /** * TpContact:is-blocked: * * %TRUE if the contact has been blocked. @@ -1350,6 +1383,22 @@ tp_contact_class_init (TpContactClass *klass) g_object_class_install_property (object_class, PROP_IS_BLOCKED, param_spec); /** + * TpContact:is-self: + * + * This is %TRUE if the contact is set as + * #TpConnection's #TpConnection:self-contact or + * #TpChannel's #TpChannel:group-self-contact, %FALSE otherwise. + * + * Since: 0.UNRELEASED + */ + param_spec = g_param_spec_boolean ("is-self", + "is local user", + "TRUE if contact is local user", + FALSE, + G_PARAM_READABLE | G_PARAM_STATIC_STRINGS); + g_object_class_install_property (object_class, PROP_IS_SELF, param_spec); + + /** * TpContact::contact-groups-changed: * @contact: A #TpContact * @added: A #GStrv with added contact groups |