diff --git a/gtk/inspector/prop-list.c b/gtk/inspector/prop-list.c index 4e0c9e9b00..60096bbc65 100644 --- a/gtk/inspector/prop-list.c +++ b/gtk/inspector/prop-list.c @@ -38,6 +38,7 @@ #include "gtkmain.h" #include "gtkstack.h" #include "gtkeventcontrollerkey.h" +#include "gtklayoutmanager.h" enum { @@ -502,4 +503,39 @@ gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl, return TRUE; } +void +gtk_inspector_prop_list_set_layout_child (GtkInspectorPropList *pl, + GObject *object) +{ + GtkWidget *stack; + GtkStackPage *page; + GtkWidget *parent; + GtkLayoutManager *layout_manager; + GtkLayoutChild *layout_child; + + stack = gtk_widget_get_parent (GTK_WIDGET (pl)); + page = gtk_stack_get_page (GTK_STACK (stack), GTK_WIDGET (pl)); + g_object_set (page, "visible", FALSE, NULL); + + if (!GTK_IS_WIDGET (object)) + return; + + parent = gtk_widget_get_parent (GTK_WIDGET (object)); + if (!parent) + return; + + layout_manager = gtk_widget_get_layout_manager (parent); + if (!layout_manager) + return; + + layout_child = gtk_layout_manager_get_layout_child (layout_manager, GTK_WIDGET (object)); + if (!layout_child) + return; + + if (!gtk_inspector_prop_list_set_object (pl, G_OBJECT (layout_child))) + return; + + g_object_set (page, "visible", TRUE, NULL); +} + // vim: set et sw=2 ts=2: diff --git a/gtk/inspector/prop-list.h b/gtk/inspector/prop-list.h index 9c293f4bc7..ad7219f13b 100644 --- a/gtk/inspector/prop-list.h +++ b/gtk/inspector/prop-list.h @@ -53,6 +53,9 @@ G_BEGIN_DECLS GType gtk_inspector_prop_list_get_type (void); gboolean gtk_inspector_prop_list_set_object (GtkInspectorPropList *pl, GObject *object); +void gtk_inspector_prop_list_set_layout_child (GtkInspectorPropList *pl, + GObject *object); + G_END_DECLS diff --git a/gtk/inspector/window.c b/gtk/inspector/window.c index 2fae04950c..2bf2a35dea 100644 --- a/gtk/inspector/window.c +++ b/gtk/inspector/window.c @@ -53,6 +53,7 @@ #include "gtktreeviewcolumn.h" #include "gtkwindowgroup.h" #include "gtkrevealer.h" +#include "gtklayoutmanager.h" G_DEFINE_TYPE (GtkInspectorWindow, gtk_inspector_window, GTK_TYPE_WINDOW) @@ -70,6 +71,7 @@ set_selected_object (GtkInspectorWindow *iw, gtk_label_set_label (GTK_LABEL (iw->object_title), title); g_free (title); + gtk_inspector_prop_list_set_layout_child (GTK_INSPECTOR_PROP_LIST (iw->layout_prop_list), selected); gtk_inspector_misc_info_set_object (GTK_INSPECTOR_MISC_INFO (iw->misc_info), selected); gtk_inspector_css_node_tree_set_object (GTK_INSPECTOR_CSS_NODE_TREE (iw->widget_css_node_tree), selected); gtk_inspector_size_groups_set_object (GTK_INSPECTOR_SIZE_GROUPS (iw->size_groups), selected); @@ -329,6 +331,7 @@ gtk_inspector_window_class_init (GtkInspectorWindowClass *klass) gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_details_button); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, select_object); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, prop_list); + gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, layout_prop_list); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_css_node_tree); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, widget_recorder); gtk_widget_class_bind_template_child (widget_class, GtkInspectorWindow, object_title); diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h index a6dafde9e4..c227782cc2 100644 --- a/gtk/inspector/window.h +++ b/gtk/inspector/window.h @@ -56,10 +56,9 @@ typedef struct GtkWidget *object_center_stack; GtkWidget *object_title; GtkWidget *prop_list; - GtkWidget *child_prop_list; + GtkWidget *layout_prop_list; GtkWidget *selector; GtkWidget *signals_list; - GtkWidget *style_prop_list; GtkWidget *classes_list; GtkWidget *widget_css_node_tree; GtkWidget *widget_recorder; diff --git a/gtk/inspector/window.ui b/gtk/inspector/window.ui index e3fcaa73f0..f6eacaf939 100644 --- a/gtk/inspector/window.ui +++ b/gtk/inspector/window.ui @@ -295,6 +295,17 @@ + + + layout-prop-search + + + 6 + 40 + + + + @@ -325,6 +336,18 @@ + + + layout_properties + Layout + + + object_tree + layout_prop_search_entry + + + + css-nodes