inspector: Avoid size changes of button path

This commit is contained in:
Matthias Clasen 2014-05-09 23:57:38 -04:00
parent 46b6a32ef0
commit e7d3323ba7
4 changed files with 59 additions and 32 deletions

View File

@ -54,16 +54,20 @@ 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);
if (GTK_IS_WIDGET (object))
{
GtkWidget *widget = GTK_WIDGET (object);
gchar *path, **words;
gint i;
path = gtk_widget_path_to_string (gtk_widget_get_path (widget));
words = g_strsplit (path, " ", 0);
@ -76,6 +80,7 @@ gtk_inspector_button_path_set_widget (GtkInspectorButtonPath *bp,
g_strfreev (words);
g_free (path);
}
}
// vim: set et sw=2 ts=2:

View File

@ -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

View File

@ -9,9 +9,19 @@
<property name="vscrollbar-policy">never</property>
<property name="hexpand">True</property>
<child>
<object class="GtkButtonBox" id="button_box">
<property name="visible">True</property>
<object class="GtkBox">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
<child>
<object class="GtkButton" id="placeholder">
<property name="margin">6</property>
<property name="label">X</property>
</object>
</child>
<child>
<object class="GtkButtonBox" id="button_box">
<property name="orientation">horizontal</property>
<property name="visible">True</property>
<property name="hexpand">True</property>
<property name="margin">6</property>
<property name="spacing">0</property>
@ -31,5 +41,15 @@
</child>
</object>
</child>
</object>
</child>
</template>
<object class="GtkSizeGroup">
<property name="mode">vertical</property>
<property name="ignore-hidden">False</property>
<widgets>
<widget name="placeholder"/>
<widget name="button_box"/>
</widgets>
</object>
</interface>

View File

@ -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);
}
}
}