[empathy] set separators between contacts



commit f25c42cb2412ceb7d0c5374fc8ce4918c01a6a53
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Mon May 21 09:49:26 2012 +0200

    set separators between contacts

 libempathy-gtk/empathy-roster-view.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c
index 21fabd4..0e7bf51 100644
--- a/libempathy-gtk/empathy-roster-view.c
+++ b/libempathy-gtk/empathy-roster-view.c
@@ -145,6 +145,26 @@ roster_view_sort (EmpathyRosterItem *a,
 }
 
 static void
+update_separator (GtkWidget **separator,
+    GtkWidget *child,
+    GtkWidget *before,
+    gpointer user_data)
+{
+  if (before == NULL)
+    {
+      /* No separator before the first row */
+      g_clear_object (separator);
+      return;
+    }
+
+  if (*separator != NULL)
+    return;
+
+  *separator = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
+  g_object_ref_sink (*separator);
+}
+
+static void
 empathy_roster_view_constructed (GObject *object)
 {
   EmpathyRosterView *self = EMPATHY_ROSTER_VIEW (object);
@@ -172,6 +192,9 @@ empathy_roster_view_constructed (GObject *object)
 
   egg_list_box_set_sort_func (EGG_LIST_BOX (self),
       (GCompareDataFunc) roster_view_sort, self, NULL);
+
+  egg_list_box_set_separator_funcs (EGG_LIST_BOX (self), update_separator,
+      self, NULL);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]