forked from AuroraMiddleware/gtk
inspector: Avoid size changes of button path
This commit is contained in:
parent
46b6a32ef0
commit
e7d3323ba7
@ -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:
|
||||
|
@ -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
|
||||
|
||||
|
@ -9,22 +9,34 @@
|
||||
<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="hexpand">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="layout-style">start</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<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="label" translatable="yes">Choose a widget through the inspector</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="spacing">0</property>
|
||||
<property name="layout-style">start</property>
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Choose a widget through the inspector</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@ -32,4 +44,12 @@
|
||||
</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>
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user