diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-08-30 20:51:21 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-01 18:01:36 +0800 |
commit | ba2d90094dbbf611a6d28c9a45f7ed892b162e91 (patch) | |
tree | e9159f73d55208bea19f0a06f83d6cc03271b526 /libempathy | |
parent | 304c189c78f86299c80beb0edbc33d0d970cf458 (diff) | |
download | gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar.gz gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar.bz2 gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar.lz gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar.xz gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.tar.zst gsoc2013-empathy-ba2d90094dbbf611a6d28c9a45f7ed892b162e91.zip |
contact: make some setters static
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-contact.c | 202 | ||||
-rw-r--r-- | libempathy/empathy-contact.h | 8 |
2 files changed, 101 insertions, 109 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index ea78476a9..60403145d 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -407,6 +407,107 @@ set_tp_contact (EmpathyContact *contact, } static void +empathy_contact_set_capabilities (EmpathyContact *contact, + EmpathyCapabilities capabilities) +{ + EmpathyContactPriv *priv; + + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + + priv = GET_PRIV (contact); + + if (priv->capabilities == capabilities) + return; + + priv->capabilities = capabilities; + + g_object_notify (G_OBJECT (contact), "capabilities"); +} + +static void +empathy_contact_set_id (EmpathyContact *contact, + const gchar *id) +{ + EmpathyContactPriv *priv; + + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + g_return_if_fail (id != NULL); + + priv = GET_PRIV (contact); + + /* We temporally ref the contact because it could be destroyed + * during the signal emition */ + g_object_ref (contact); + if (tp_strdiff (id, priv->id)) + { + g_free (priv->id); + priv->id = g_strdup (id); + + g_object_notify (G_OBJECT (contact), "id"); + if (EMP_STR_EMPTY (priv->alias)) + g_object_notify (G_OBJECT (contact), "alias"); + } + + g_object_unref (contact); +} + +static void +empathy_contact_set_presence (EmpathyContact *contact, + TpConnectionPresenceType presence) +{ + EmpathyContactPriv *priv; + TpConnectionPresenceType old_presence; + + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + + priv = GET_PRIV (contact); + + if (presence == priv->presence) + return; + + old_presence = priv->presence; + priv->presence = presence; + + g_signal_emit (contact, signals[PRESENCE_CHANGED], 0, presence, old_presence); + + g_object_notify (G_OBJECT (contact), "presence"); +} + +static void +empathy_contact_set_presence_message (EmpathyContact *contact, + const gchar *message) +{ + EmpathyContactPriv *priv = GET_PRIV (contact); + + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + + if (priv->persona != NULL) + { + folks_presence_set_presence_message (FOLKS_PRESENCE (priv->persona), + message); + } +} + +static void +empathy_contact_set_handle (EmpathyContact *contact, + guint handle) +{ + EmpathyContactPriv *priv; + + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + + priv = GET_PRIV (contact); + + g_object_ref (contact); + if (handle != priv->handle) + { + priv->handle = handle; + g_object_notify (G_OBJECT (contact), "handle"); + } + g_object_unref (contact); +} + +static void contact_get_property (GObject *object, guint param_id, GValue *value, @@ -565,33 +666,6 @@ empathy_contact_get_id (EmpathyContact *contact) return priv->id; } -void -empathy_contact_set_id (EmpathyContact *contact, - const gchar *id) -{ - EmpathyContactPriv *priv; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - g_return_if_fail (id != NULL); - - priv = GET_PRIV (contact); - - /* We temporally ref the contact because it could be destroyed - * during the signal emition */ - g_object_ref (contact); - if (tp_strdiff (id, priv->id)) - { - g_free (priv->id); - priv->id = g_strdup (id); - - g_object_notify (G_OBJECT (contact), "id"); - if (EMP_STR_EMPTY (priv->alias)) - g_object_notify (G_OBJECT (contact), "alias"); - } - - g_object_unref (contact); -} - const gchar * empathy_contact_get_alias (EmpathyContact *contact) { @@ -880,28 +954,6 @@ empathy_contact_get_presence (EmpathyContact *contact) return priv->presence; } -void -empathy_contact_set_presence (EmpathyContact *contact, - TpConnectionPresenceType presence) -{ - EmpathyContactPriv *priv; - TpConnectionPresenceType old_presence; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - priv = GET_PRIV (contact); - - if (presence == priv->presence) - return; - - old_presence = priv->presence; - priv->presence = presence; - - g_signal_emit (contact, signals[PRESENCE_CHANGED], 0, presence, old_presence); - - g_object_notify (G_OBJECT (contact), "presence"); -} - const gchar * empathy_contact_get_presence_message (EmpathyContact *contact) { @@ -917,21 +969,6 @@ empathy_contact_get_presence_message (EmpathyContact *contact) return NULL; } -void -empathy_contact_set_presence_message (EmpathyContact *contact, - const gchar *message) -{ - EmpathyContactPriv *priv = GET_PRIV (contact); - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - if (priv->persona != NULL) - { - folks_presence_set_presence_message (FOLKS_PRESENCE (priv->persona), - message); - } -} - guint empathy_contact_get_handle (EmpathyContact *contact) { @@ -947,25 +984,6 @@ empathy_contact_get_handle (EmpathyContact *contact) return priv->handle; } -void -empathy_contact_set_handle (EmpathyContact *contact, - guint handle) -{ - EmpathyContactPriv *priv; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - priv = GET_PRIV (contact); - - g_object_ref (contact); - if (handle != priv->handle) - { - priv->handle = handle; - g_object_notify (G_OBJECT (contact), "handle"); - } - g_object_unref (contact); -} - EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact) { @@ -978,24 +996,6 @@ empathy_contact_get_capabilities (EmpathyContact *contact) return priv->capabilities; } -void -empathy_contact_set_capabilities (EmpathyContact *contact, - EmpathyCapabilities capabilities) -{ - EmpathyContactPriv *priv; - - g_return_if_fail (EMPATHY_IS_CONTACT (contact)); - - priv = GET_PRIV (contact); - - if (priv->capabilities == capabilities) - return; - - priv->capabilities = capabilities; - - g_object_notify (G_OBJECT (contact), "capabilities"); -} - gboolean empathy_contact_is_user (EmpathyContact *contact) { diff --git a/libempathy/empathy-contact.h b/libempathy/empathy-contact.h index e9b1c8697..c1ef55d6b 100644 --- a/libempathy/empathy-contact.h +++ b/libempathy/empathy-contact.h @@ -75,7 +75,6 @@ EmpathyContact * empathy_contact_from_tpl_contact (TpAccount *account, TplEntity *tpl_contact); TpContact * empathy_contact_get_tp_contact (EmpathyContact *contact); const gchar * empathy_contact_get_id (EmpathyContact *contact); -void empathy_contact_set_id (EmpathyContact *contact, const gchar *id); const gchar * empathy_contact_get_alias (EmpathyContact *contact); void empathy_contact_set_alias (EmpathyContact *contact, const gchar *alias); void empathy_contact_change_group (EmpathyContact *contact, const gchar *group, @@ -87,16 +86,9 @@ void empathy_contact_set_persona (EmpathyContact *contact, FolksPersona *persona); TpConnection * empathy_contact_get_connection (EmpathyContact *contact); TpConnectionPresenceType empathy_contact_get_presence (EmpathyContact *contact); -void empathy_contact_set_presence (EmpathyContact *contact, - TpConnectionPresenceType presence); const gchar * empathy_contact_get_presence_message (EmpathyContact *contact); -void empathy_contact_set_presence_message (EmpathyContact *contact, - const gchar *message); guint empathy_contact_get_handle (EmpathyContact *contact); -void empathy_contact_set_handle (EmpathyContact *contact, guint handle); EmpathyCapabilities empathy_contact_get_capabilities (EmpathyContact *contact); -void empathy_contact_set_capabilities (EmpathyContact *contact, - EmpathyCapabilities capabilities); gboolean empathy_contact_is_user (EmpathyContact *contact); void empathy_contact_set_is_user (EmpathyContact *contact, gboolean is_user); |