From e7d3323ba7b5cdb6a67f84840db0c17205215efa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 9 May 2014 23:57:38 -0400 Subject: [PATCH] inspector: Avoid size changes of button path --- modules/inspector/button-path.c | 35 ++++++++++++++----------- modules/inspector/button-path.h | 4 +-- modules/inspector/button-path.ui | 44 +++++++++++++++++++++++--------- modules/inspector/window.c | 8 +++--- 4 files changed, 59 insertions(+), 32 deletions(-) diff --git a/modules/inspector/button-path.c b/modules/inspector/button-path.c index 339d4a16ad..6019143c52 100644 --- a/modules/inspector/button-path.c +++ b/modules/inspector/button-path.c @@ -54,28 +54,33 @@ gtk_inspector_button_path_new (void) } void -gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp, - GtkWidget *widget) +gtk_inspector_button_path_set_object (GtkInspectorButtonPath *bp, + GObject *object) { - gchar *path, **words; - gint i; - GtkWidget *b; GtkContainer *box = GTK_CONTAINER (bp->priv->button_box); + GtkWidget *b; gtk_container_foreach (box, (GtkCallback)gtk_widget_destroy, NULL); - path = gtk_widget_path_to_string (gtk_widget_get_path (widget)); - words = g_strsplit (path, " ", 0); - - for (i = 0; i < g_strv_length (words); i++) + if (GTK_IS_WIDGET (object)) { - b = gtk_button_new_with_label (words[i]); - gtk_widget_show (b); - gtk_container_add (box, b); - } + GtkWidget *widget = GTK_WIDGET (object); + gchar *path, **words; + gint i; - g_strfreev (words); - g_free (path); + path = gtk_widget_path_to_string (gtk_widget_get_path (widget)); + words = g_strsplit (path, " ", 0); + + for (i = 0; i < g_strv_length (words); i++) + { + b = gtk_button_new_with_label (words[i]); + gtk_widget_show (b); + gtk_container_add (box, b); + } + + g_strfreev (words); + g_free (path); + } } // vim: set et sw=2 ts=2: diff --git a/modules/inspector/button-path.h b/modules/inspector/button-path.h index 32f3d93442..6ee59b3325 100644 --- a/modules/inspector/button-path.h +++ b/modules/inspector/button-path.h @@ -51,8 +51,8 @@ G_BEGIN_DECLS GType gtk_inspector_button_path_get_type (void); GtkWidget *gtk_inspector_button_path_new (void); -void gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp, - GtkWidget *widget); +void gtk_inspector_button_path_set_object (GtkInspectorButtonPath *bp, + GObject *object); G_END_DECLS diff --git a/modules/inspector/button-path.ui b/modules/inspector/button-path.ui index b586f4198c..5f832f7170 100644 --- a/modules/inspector/button-path.ui +++ b/modules/inspector/button-path.ui @@ -9,22 +9,34 @@ never True - - True + horizontal - True - 6 - 0 - start - + True - + + 6 + X + + + + + horizontal True - Choose a widget through the inspector True - 0.5 + 6 + 0 + start + + + + True + Choose a widget through the inspector + True + 0.5 + + @@ -32,4 +44,12 @@ + + vertical + False + + + + + diff --git a/modules/inspector/window.c b/modules/inspector/window.c index 04790b26cc..499129f790 100644 --- a/modules/inspector/window.c +++ b/modules/inspector/window.c @@ -75,20 +75,22 @@ on_widget_tree_selection_changed (GtkInspectorWidgetTree *wt, gtk_inspector_prop_list_set_object (GTK_INSPECTOR_PROP_LIST (iw->child_prop_list), selected); gtk_inspector_signals_list_set_object (GTK_INSPECTOR_SIGNALS_LIST (iw->signals_list), selected); gtk_inspector_object_hierarchy_set_object (GTK_INSPECTOR_OBJECT_HIERARCHY (iw->object_hierarchy), selected); + gtk_inspector_button_path_set_object (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), selected); if (GTK_IS_WIDGET (selected)) { GtkWidget *widget = GTK_WIDGET (selected); gtk_inspector_flash_widget (iw, widget); - gtk_inspector_button_path_set_widget (GTK_INSPECTOR_BUTTON_PATH (iw->button_path), widget); gtk_inspector_classes_list_set_widget (GTK_INSPECTOR_CLASSES_LIST (iw->classes_list), widget); gtk_inspector_css_editor_set_widget (GTK_INSPECTOR_CSS_EDITOR (iw->widget_css_editor), widget); + gtk_widget_set_visible (iw->classes_list, TRUE); + gtk_widget_set_visible (iw->widget_css_editor, TRUE); } else { - gtk_widget_set_sensitive (iw->classes_list, FALSE); - gtk_widget_set_sensitive (iw->widget_css_editor, FALSE); + gtk_widget_set_visible (iw->classes_list, FALSE); + gtk_widget_set_visible (iw->widget_css_editor, FALSE); } } }