]> git.0d.be Git - empathy.git/commitdiff
add empathy_roster_contact_set_event_icon()
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 11 Jun 2012 10:17:43 +0000 (12:17 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Thu, 14 Jun 2012 07:21:50 +0000 (09:21 +0200)
Will be used to display events in the contact list.

libempathy-gtk/empathy-roster-contact.c
libempathy-gtk/empathy-roster-contact.h

index ef3d9ec797846fe440a1c8a968dc4ca400d09bdd..6e2014aaf79c4d9210d3ed8b2fbe989c96df81c9 100644 (file)
@@ -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);
+}
index a7c5b086669bed64c4ecbe74469468232b9ca2f6..a488e942438ef0ba9fe5177426923b4c19f9ec15 100644 (file)
@@ -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__*/