[gtk/prop-list: 94/96] inspector: Add columns to the object tree



commit 98aedb7592ed25842fb6c980aa5e2992c20d5922
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 6fff61af18..fd94e01d8a 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -351,6 +351,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)
 {
@@ -529,6 +552,11 @@ static const ObjectTreeClassFuncs object_tree_class_funcs[] = {
     object_tree_menu_get_parent,
     object_tree_widget_get_children
   },
+  {
+    gtk_column_view_get_type,
+    object_tree_widget_get_parent,
+    object_tree_column_view_get_children 
+  },
   {
     gtk_widget_get_type,
     object_tree_widget_get_parent,


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