]> git.0d.be Git - empathy.git/commitdiff
Display icon near the favorite fake group
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 9 Mar 2010 15:31:59 +0000 (16:31 +0100)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 15 Mar 2010 08:28:41 +0000 (09:28 +0100)
libempathy-gtk/empathy-contact-list-view.c

index 705494e4ada377351ff601cbd5b8a930dabda91d..5b6686896b5d46b618b95bc11e47ba8658b7078a 100644 (file)
@@ -878,6 +878,43 @@ contact_list_view_pixbuf_cell_data_func (GtkTreeViewColumn     *tree_column,
        contact_list_view_cell_set_background (view, cell, is_group, is_active);
 }
 
+static void
+contact_list_view_group_icon_cell_data_func (GtkTreeViewColumn     *tree_column,
+                                            GtkCellRenderer       *cell,
+                                            GtkTreeModel          *model,
+                                            GtkTreeIter           *iter,
+                                            EmpathyContactListView *view)
+{
+       GdkPixbuf *pixbuf = NULL;
+       gboolean is_group;
+       gchar *name;
+
+       gtk_tree_model_get (model, iter,
+                           EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, &is_group,
+                           EMPATHY_CONTACT_LIST_STORE_COL_NAME, &name,
+                           -1);
+
+       if (!is_group)
+               goto out;;
+
+       if (tp_strdiff (name, EMPATHY_CONTACT_LIST_STORE_FAVORITE))
+               goto out;;
+
+       pixbuf = empathy_pixbuf_from_icon_name ("emblem-favorite",
+               GTK_ICON_SIZE_MENU);
+
+out:
+       g_object_set (cell,
+                     "visible", pixbuf != NULL,
+                     "pixbuf", pixbuf,
+                     NULL);
+
+       if (pixbuf != NULL)
+               g_object_unref (pixbuf);
+
+       g_free (name);
+}
+
 static void
 contact_list_view_audio_call_cell_data_func (
                                       GtkTreeViewColumn      *tree_column,
@@ -1115,6 +1152,22 @@ contact_list_view_setup (EmpathyContactListView *view)
                      "visible", FALSE,
                      NULL);
 
+       /* Group icon */
+       cell = gtk_cell_renderer_pixbuf_new ();
+       gtk_tree_view_column_pack_start (col, cell, FALSE);
+       gtk_tree_view_column_set_cell_data_func (
+               col, cell,
+               (GtkTreeCellDataFunc) contact_list_view_group_icon_cell_data_func,
+               view, NULL);
+
+       g_object_set (cell,
+                     "xpad", 0,
+                     "ypad", 0,
+                     "visible", FALSE,
+                     "width", 16,
+                     "height", 16,
+                     NULL);
+
        /* Name */
        cell = empathy_cell_renderer_text_new ();
        gtk_tree_view_column_pack_start (col, cell, TRUE);