summaryrefslogtreecommitdiff
path: root/demos
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-11-29 18:49:46 -0500
committerMatthias Clasen <mclasen@redhat.com>2014-11-29 18:49:46 -0500
commit5bf640d34448e013d7f3cebfe662141c951fceab (patch)
tree6acdf8455a401e74eb41a6dc74f09a131f458d30 /demos
parentafe0d5ff0045ea143ae57f96df1695575b45584d (diff)
downloadgtk+-5bf640d34448e013d7f3cebfe662141c951fceab.tar.gz
widget-factory: Add a treeview separator row
Suggested in https://bugzilla.gnome.org/show_bug.cgi?id=740851
Diffstat (limited to 'demos')
-rw-r--r--demos/widget-factory/widget-factory.c19
-rw-r--r--demos/widget-factory/widget-factory.ui1
2 files changed, 20 insertions, 0 deletions
diff --git a/demos/widget-factory/widget-factory.c b/demos/widget-factory/widget-factory.c
index 6d2900bbf6..4829925e8e 100644
--- a/demos/widget-factory/widget-factory.c
+++ b/demos/widget-factory/widget-factory.c
@@ -547,6 +547,24 @@ populate_model (GtkTreeStore *store)
gtk_tree_store_set (store, &iter,
0, "Gisele of Aquitaine",
-1);
+ gtk_tree_store_append (store, &iter, NULL);
+ gtk_tree_store_set (store, &iter, 3, TRUE, -1);
+ gtk_tree_store_append (store, &iter, NULL);
+ gtk_tree_store_set (store, &iter,
+ 0, "Attila the Hun",
+ 1, "ca. 390",
+ 2, "453",
+ -1);
+}
+
+static gboolean
+row_separator_func (GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
+{
+ gboolean is_sep;
+
+ gtk_tree_model_get (model, iter, 3, &is_sep, -1);
+
+ return is_sep;
}
static void
@@ -1235,6 +1253,7 @@ activate (GApplication *app)
widget = (GtkWidget *)gtk_builder_get_object (builder, "charletree");
populate_model ((GtkTreeStore *)gtk_tree_view_get_model (GTK_TREE_VIEW (widget)));
+ gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (widget), row_separator_func, NULL, NULL);
gtk_tree_view_expand_all (GTK_TREE_VIEW (widget));
populate_colors ((GtkWidget *)gtk_builder_get_object (builder, "munsell"));
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index 346c4af939..7b7cee0751 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -332,6 +332,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<column type="gchararray"/>
<column type="gchararray"/>
<column type="gchararray"/>
+ <column type="gboolean"/>
</columns>
</object>
<object class="GtkApplicationWindow" id="window">