[gnome-builder/wip/greeter] util: add listbox separator row helper



commit dbcbbbe26c595f8946e3d10d849625f0f9370486
Author: Christian Hergert <christian hergert me>
Date:   Sat May 9 21:54:18 2015 -0700

    util: add listbox separator row helper
    
    We do this a fair bit. Might as well abstract it.

 src/util/gb-gtk.c |   20 ++++++++++++++++++++
 src/util/gb-gtk.h |    4 ++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/util/gb-gtk.c b/src/util/gb-gtk.c
index e1f3184..ed30b6d 100644
--- a/src/util/gb-gtk.c
+++ b/src/util/gb-gtk.c
@@ -186,3 +186,23 @@ gb_gtk_text_iter_get_next_char (const GtkTextIter *iter)
 
   return gtk_text_iter_get_char (&copy);
 }
+
+void
+gb_gtk_list_box_row_separator_func (GtkListBoxRow *row,
+                                    GtkListBoxRow *before,
+                                    gpointer       user_data)
+{
+  g_return_if_fail (GTK_IS_LIST_BOX_ROW (row));
+  g_return_if_fail (!before || GTK_IS_LIST_BOX_ROW (before));
+
+  if (before != NULL)
+    {
+      GtkWidget *header;
+
+      header = g_object_new (GTK_TYPE_SEPARATOR,
+                             "orientation", GTK_ORIENTATION_HORIZONTAL,
+                             "visible", TRUE,
+                             NULL);
+      gtk_list_box_row_set_header (row, header);
+    }
+}
diff --git a/src/util/gb-gtk.h b/src/util/gb-gtk.h
index 6c5129d..8724c45 100644
--- a/src/util/gb-gtk.h
+++ b/src/util/gb-gtk.h
@@ -35,6 +35,10 @@ void gb_gtk_text_view_scroll_to_iter (GtkTextView *text_view,
                                       gdouble      xalign,
                                       gdouble      yalign);
 
+void gb_gtk_list_box_row_separator_func (GtkListBoxRow *row,
+                                         GtkListBoxRow *before,
+                                         gpointer       user_data);
+
 gboolean gb_gtk_text_view_get_iter_visible (GtkTextView *text_view,
                                             GtkTextIter *iter);
 


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