[gtk/wip/otte/listview: 66/146] inspector: Use a GtkTreeExpander in the object tree
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/otte/listview: 66/146] inspector: Use a GtkTreeExpander in the object tree
- Date: Wed, 4 Mar 2020 20:16:52 +0000 (UTC)
commit f30c59905b3c927f428223960efc646af8f3794c
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 14 06:22:41 2019 +0200
inspector: Use a GtkTreeExpander in the object tree
gtk/inspector/object-tree.c | 37 +++++++------------------------------
1 file changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/gtk/inspector/object-tree.c b/gtk/inspector/object-tree.c
index 4562a824b4..66d56cfa80 100644
--- a/gtk/inspector/object-tree.c
+++ b/gtk/inspector/object-tree.c
@@ -47,6 +47,7 @@
#include "gtksizegroup.h"
#include "gtktextview.h"
#include "gtktogglebutton.h"
+#include "gtktreeexpander.h"
#include "gtktreelistmodel.h"
#include "gtktreeview.h"
#include "gtktreeselection.h"
@@ -989,7 +990,6 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item,
GtkInspectorObjectTree *wt = user_data;
gpointer item;
GtkWidget *row, *box, *column, *child;
- guint depth;
item = gtk_tree_list_row_get_item (row_item);
@@ -1006,37 +1006,14 @@ gtk_inspector_object_tree_create_list_widget (gpointer row_item,
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (row), box);
- column = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_size_group_add_widget (wt->priv->type_size_group, column);
- gtk_container_add (GTK_CONTAINER (box), column);
-
/* expander */
- depth = gtk_tree_list_row_get_depth (row_item);
- if (depth > 0)
- {
- child = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_size_request (child, 16 * depth, 0);
- gtk_container_add (GTK_CONTAINER (column), child);
- }
- if (gtk_tree_list_row_is_expandable (row_item))
- {
- GtkWidget *title, *arrow;
-
- child = g_object_new (GTK_TYPE_BOX, "css-name", "expander", NULL);
-
- title = g_object_new (GTK_TYPE_TOGGLE_BUTTON, "css-name", "title", NULL);
- gtk_button_set_relief (GTK_BUTTON (title), GTK_RELIEF_NONE);
- g_object_bind_property (row_item, "expanded", title, "active", G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
- gtk_container_add (GTK_CONTAINER (child), title);
+ child = gtk_tree_expander_new ();
+ gtk_tree_expander_set_list_row (GTK_TREE_EXPANDER (child), row_item);
+ gtk_size_group_add_widget (wt->priv->type_size_group, child);
+ gtk_container_add (GTK_CONTAINER (box), child);
- arrow = gtk_builtin_icon_new ("expander");
- gtk_container_add (GTK_CONTAINER (title), arrow);
- }
- else
- {
- child = gtk_image_new (); /* empty whatever */
- }
- gtk_container_add (GTK_CONTAINER (column), child);
+ column = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_tree_expander_set_child (GTK_TREE_EXPANDER (child), column);
/* 1st column: type name */
child = gtk_label_new (G_OBJECT_TYPE_NAME (item));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]