[gtk/columnview-work: 1/42] inspector: Add columns to the object tree



commit 6d168079d4d5dcd84229cc90e7819fb0a76e486b
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Dec 17 23:51:11 2019 -0500

    inspector: Add columns to the object tree
    
    Add columnview columns in the object tree.
    We do the same for treeview columns.

 gtk/inspector/object-tree.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
---
diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c
index 6bf5961db4..60d96081f4 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -336,6 +336,29 @@ object_tree_tree_view_get_children (GObject *object)
   return G_LIST_MODEL (result);
 }
 
+static GListModel *
+object_tree_column_view_get_children (GObject *object)
+{
+  GtkColumnView *view = GTK_COLUMN_VIEW (object);
+  GListStore *result_list;
+  GtkFlattenListModel *result;
+  GListModel *columns, *sublist;
+
+  result_list = g_list_store_new (G_TYPE_LIST_MODEL);
+
+  columns = gtk_column_view_get_columns (view);
+  g_list_store_append (result_list, columns);
+
+  sublist = object_tree_widget_get_children (object);
+  g_list_store_append (result_list, sublist);
+  g_object_unref (sublist);
+
+  result = gtk_flatten_list_model_new (G_TYPE_OBJECT, G_LIST_MODEL (result_list));
+  g_object_unref (result_list);
+
+  return G_LIST_MODEL (result);
+}
+
 static GListModel *
 object_tree_icon_view_get_children (GObject *object)
 {
@@ -499,6 +522,11 @@ static const ObjectTreeClassFuncs object_tree_class_funcs[] = {
     object_tree_widget_get_parent,
     object_tree_tree_view_get_children
   },
+  {
+    gtk_column_view_get_type,
+    object_tree_widget_get_parent,
+    object_tree_column_view_get_children
+  },
   {
     gtk_combo_box_get_type,
     object_tree_widget_get_parent,


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