inspector: Show object title in size groups tab

This commit is contained in:
Matthias Clasen 2014-11-22 20:56:49 -05:00
parent d09f66579b
commit 0a37493384

View File

@ -215,6 +215,7 @@ add_size_group (GtkInspectorSizeGroups *sl,
frame = gtk_frame_new (NULL); frame = gtk_frame_new (NULL);
gtk_container_add (GTK_CONTAINER (sl), frame); gtk_container_add (GTK_CONTAINER (sl), frame);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_style_context_add_class (gtk_widget_get_style_context (box), GTK_STYLE_CLASS_VIEW);
gtk_container_add (GTK_CONTAINER (frame), box); gtk_container_add (GTK_CONTAINER (frame), box);
box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10); box2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
@ -273,6 +274,8 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
GObject *object) GObject *object)
{ {
GSList *groups, *l; GSList *groups, *l;
const gchar *title;
GtkWidget *label;
clear_view (sl); clear_view (sl);
@ -282,6 +285,16 @@ gtk_inspector_size_groups_set_object (GtkInspectorSizeGroups *sl,
return; return;
} }
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
label = gtk_label_new (title);
gtk_widget_set_halign (label, GTK_ALIGN_FILL);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_margin_top (label, 12);
gtk_widget_set_margin_bottom (label, 30);
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (sl), label);
groups = _gtk_widget_get_sizegroups (GTK_WIDGET (object)); groups = _gtk_widget_get_sizegroups (GTK_WIDGET (object));
if (groups) if (groups)
gtk_widget_show (GTK_WIDGET (sl)); gtk_widget_show (GTK_WIDGET (sl));
@ -297,8 +310,10 @@ gtk_inspector_size_groups_init (GtkInspectorSizeGroups *sl)
{ {
g_object_set (sl, g_object_set (sl,
"orientation", GTK_ORIENTATION_VERTICAL, "orientation", GTK_ORIENTATION_VERTICAL,
"margin", 40, "margin-start", 60,
"spacing", 20, "margin-end", 60,
"margin-bottom", 60,
"spacing", 10,
NULL); NULL);
} }