diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:21 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-03-11 20:22:21 +0800 |
commit | ba02e026e2dc5a87bf13047a2de1b132fb5044dc (patch) | |
tree | cb7068fe5968349582e6aab739e9792c187681ce /libempathy/empathy-contact.c | |
parent | 1f33373505c9f42a9c9d764431a0b53bf993d31b (diff) | |
download | gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar.gz gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar.bz2 gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar.lz gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar.xz gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.tar.zst gsoc2013-empathy-ba02e026e2dc5a87bf13047a2de1b132fb5044dc.zip |
Add a ready property on EmpathyContact and make use of tp_strdiff.
svn path=/trunk/; revision=747
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r-- | libempathy/empathy-contact.c | 45 |
1 files changed, 32 insertions, 13 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index d841a1b76..ef6b87dbf 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -53,6 +53,7 @@ struct _EmpathyContactPriv { EmpathyCapabilities capabilities; gboolean is_user; guint hash; + gboolean ready; }; static void empathy_contact_class_init (EmpathyContactClass *class); @@ -79,7 +80,8 @@ enum { PROP_PRESENCE_MESSAGE, PROP_HANDLE, PROP_CAPABILITIES, - PROP_IS_USER + PROP_IS_USER, + PROP_READY }; static void @@ -169,6 +171,14 @@ empathy_contact_class_init (EmpathyContactClass *class) FALSE, G_PARAM_READWRITE)); + g_object_class_install_property (object_class, + PROP_READY, + g_param_spec_boolean ("ready", + "Contact ready", + "Is contact ready", + FALSE, + G_PARAM_READABLE)); + g_type_class_add_private (object_class, sizeof (EmpathyContactPriv)); } @@ -213,8 +223,7 @@ contact_get_property (GObject *object, switch (param_id) { case PROP_ID: - g_value_set_string (value, - empathy_contact_get_id (EMPATHY_CONTACT (object))); + g_value_set_string (value, priv->id); break; case PROP_NAME: g_value_set_string (value, @@ -241,6 +250,9 @@ contact_get_property (GObject *object, case PROP_IS_USER: g_value_set_boolean (value, priv->is_user); break; + case PROP_READY: + g_value_set_boolean (value, priv->ready); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); break; @@ -325,15 +337,11 @@ empathy_contact_get_id (EmpathyContact *contact) { EmpathyContactPriv *priv; - g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), ""); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); - if (priv->id) { - return priv->id; - } - - return ""; + return priv->id; } void @@ -347,7 +355,7 @@ empathy_contact_set_id (EmpathyContact *contact, priv = GET_PRIV (contact); - if (priv->id && strcmp (id, priv->id) == 0) { + if (!tp_strdiff (id, priv->id)) { return; } @@ -365,7 +373,7 @@ empathy_contact_get_name (EmpathyContact *contact) { EmpathyContactPriv *priv; - g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), ""); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), NULL); priv = GET_PRIV (contact); @@ -383,11 +391,10 @@ empathy_contact_set_name (EmpathyContact *contact, EmpathyContactPriv *priv; g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - g_return_if_fail (name != NULL); priv = GET_PRIV (contact); - if (priv->name && strcmp (name, priv->name) == 0) { + if (!tp_strdiff (name, priv->name)) { return; } @@ -666,6 +673,18 @@ empathy_contact_can_voip (EmpathyContact *contact) } gboolean +empathy_contact_is_ready (EmpathyContact *contact) +{ + EmpathyContactPriv *priv; + + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); + + priv = GET_PRIV (contact); + + return priv->ready; +} + +gboolean empathy_contact_equal (gconstpointer v1, gconstpointer v2) { |