inspector: Show object title on selector tab

This commit is contained in:
Matthias Clasen 2014-11-22 16:21:17 -05:00
parent 38c3600d8b
commit f38081a4a5
2 changed files with 17 additions and 1 deletions

View File

@ -24,6 +24,7 @@
#include "gtktreestore.h"
#include "gtktreeview.h"
#include "gtkwidgetpath.h"
#include "gtklabel.h"
enum
@ -35,6 +36,7 @@ struct _GtkInspectorSelectorPrivate
{
GtkTreeStore *model;
GtkTreeView *tree;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorSelector, gtk_inspector_selector, GTK_TYPE_BOX)
@ -54,6 +56,7 @@ gtk_inspector_selector_class_init (GtkInspectorSelectorClass *klass)
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/selector.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorSelector, object_title);
}
void
@ -64,6 +67,7 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
gint i;
GtkWidget *widget;
gchar *path, **words;
const gchar *title;
gtk_tree_store_clear (oh->priv->model);
@ -73,6 +77,9 @@ gtk_inspector_selector_set_object (GtkInspectorSelector *oh,
return;
}
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
widget = GTK_WIDGET (object);
path = gtk_widget_path_to_string (gtk_widget_get_path (widget));

View File

@ -6,7 +6,16 @@
</columns>
</object>
<template class="GtkInspectorSelector" parent="GtkBox">
<property name="orientation">horizontal</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="object_title">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="valign">center</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>