diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-11 18:17:43 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2012-06-14 15:21:50 +0800 |
commit | 4726282c4b6985a0b34e77b7b7955bcad233cf50 (patch) | |
tree | e9c5dabd029f37ba6862b296e2d08ef37d6a5aa0 | |
parent | 7ce8a9a175f90a8e214eb80a36aaa57fddcacb52 (diff) | |
download | gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar.gz gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar.bz2 gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar.lz gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar.xz gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.tar.zst gsoc2013-empathy-4726282c4b6985a0b34e77b7b7955bcad233cf50.zip |
add empathy_roster_contact_set_event_icon()
Will be used to display events in the contact list.
-rw-r--r-- | libempathy-gtk/empathy-roster-contact.c | 22 | ||||
-rw-r--r-- | libempathy-gtk/empathy-roster-contact.h | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/libempathy-gtk/empathy-roster-contact.c b/libempathy-gtk/empathy-roster-contact.c index ef3d9ec79..6e2014aaf 100644 --- a/libempathy-gtk/empathy-roster-contact.c +++ b/libempathy-gtk/empathy-roster-contact.c @@ -43,6 +43,9 @@ struct _EmpathyRosterContactPriv GtkWidget *presence_icon; GtkWidget *phone_icon; + /* If not NULL, used instead of the individual's presence icon */ + gchar *event_icon; + gboolean online; }; @@ -227,7 +230,10 @@ update_presence_icon (EmpathyRosterContact *self) { const gchar *icon; - icon = empathy_icon_name_for_individual (self->priv->individual); + if (self->priv->event_icon == NULL) + icon = empathy_icon_name_for_individual (self->priv->individual); + else + icon = self->priv->event_icon; gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->presence_icon), icon, GTK_ICON_SIZE_MENU); @@ -331,6 +337,7 @@ empathy_roster_contact_finalize (GObject *object) ((GObjectClass *) empathy_roster_contact_parent_class)->finalize; g_free (self->priv->group); + g_free (self->priv->event_icon); if (chain_up != NULL) chain_up (object); @@ -477,3 +484,16 @@ empathy_roster_contact_get_group (EmpathyRosterContact *self) { return self->priv->group; } + +void +empathy_roster_contact_set_event_icon (EmpathyRosterContact *self, + const gchar *icon) +{ + if (!tp_strdiff (self->priv->event_icon, icon)) + return; + + g_free (self->priv->event_icon); + self->priv->event_icon = g_strdup (icon); + + update_presence_icon (self); +} diff --git a/libempathy-gtk/empathy-roster-contact.h b/libempathy-gtk/empathy-roster-contact.h index a7c5b0866..a488e9424 100644 --- a/libempathy-gtk/empathy-roster-contact.h +++ b/libempathy-gtk/empathy-roster-contact.h @@ -56,6 +56,9 @@ const gchar * empathy_roster_contact_get_group (EmpathyRosterContact *self); gboolean empathy_roster_contact_is_online (EmpathyRosterContact *self); +void empathy_roster_contact_set_event_icon (EmpathyRosterContact *self, + const gchar *icon); + G_END_DECLS #endif /* #ifndef __EMPATHY_ROSTER_CONTACT_H__*/ |