[gtk/wip/matthiasc/listview-2: 85/168] inspector: Use a treeexpander in the recorder
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/matthiasc/listview-2: 85/168] inspector: Use a treeexpander in the recorder
- Date: Fri, 29 May 2020 20:37:30 +0000 (UTC)
commit 134692540c957f578afa37af2a64e86d864ed019
Author: Benjamin Otte <otte redhat com>
Date: Mon Oct 14 06:18:25 2019 +0200
inspector: Use a treeexpander in the recorder
gtk/inspector/recorder.c | 37 +++++++------------------------------
1 file changed, 7 insertions(+), 30 deletions(-)
---
diff --git a/gtk/inspector/recorder.c b/gtk/inspector/recorder.c
index 1717ddc587..acd82a1613 100644
--- a/gtk/inspector/recorder.c
+++ b/gtk/inspector/recorder.c
@@ -28,6 +28,7 @@
#include <gtk/gtkpicture.h>
#include <gtk/gtkpopover.h>
#include <gtk/gtktogglebutton.h>
+#include <gtk/gtktreeexpander.h>
#include <gtk/gtktreelistmodel.h>
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreeview.h>
@@ -300,44 +301,20 @@ create_widget_for_render_node (gpointer row_item,
{
GdkPaintable *paintable;
GskRenderNode *node;
- GtkWidget *row, *box, *child;
+ GtkWidget *row, *expander, *box, *child;
char *name;
- guint depth;
paintable = gtk_tree_list_row_get_item (row_item);
node = gtk_render_node_paintable_get_render_node (GTK_RENDER_NODE_PAINTABLE (paintable));
row = gtk_list_box_row_new ();
- box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
- gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), box);
/* 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_box_append (GTK_BOX (box), 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_has_frame (GTK_BUTTON (title), FALSE);
- g_object_bind_property (row_item, "expanded", title, "active", G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
- gtk_box_append (GTK_BOX (child), title);
- g_object_set_data_full (G_OBJECT (row), "make-sure-its-not-unreffed", g_object_ref (row_item),
g_object_unref);
+ expander = gtk_tree_expander_new ();
+ gtk_tree_expander_set_list_row (GTK_TREE_EXPANDER (expander), row_item);
+ gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (row), expander);
- arrow = gtk_builtin_icon_new ("expander");
- gtk_button_set_child (GTK_BUTTON (title), arrow);
- }
- else
- {
- child = gtk_image_new (); /* empty whatever */
- }
- gtk_box_append (GTK_BOX (box), child);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 3);
+ gtk_tree_expander_set_child (GTK_TREE_EXPANDER (expander), box);
/* icon */
child = gtk_image_new_from_paintable (paintable);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]