inspector: Show object title in hierarchy tab

This commit is contained in:
Matthias Clasen 2014-11-22 13:54:16 -05:00
parent 85380f22f3
commit d2aad06513
2 changed files with 18 additions and 2 deletions

View File

@ -28,6 +28,7 @@
#include "gtktreeselection.h"
#include "gtktreestore.h"
#include "gtktreeview.h"
#include "gtklabel.h"
enum
@ -39,6 +40,7 @@ struct _GtkInspectorObjectHierarchyPrivate
{
GtkTreeStore *model;
GtkTreeView *tree;
GtkWidget *object_title;
};
G_DEFINE_TYPE_WITH_PRIVATE (GtkInspectorObjectHierarchy, gtk_inspector_object_hierarchy, GTK_TYPE_BOX)
@ -58,6 +60,7 @@ gtk_inspector_object_hierarchy_class_init (GtkInspectorObjectHierarchyClass *kla
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/inspector/object-hierarchy.ui");
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, model);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, tree);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorObjectHierarchy, object_title);
}
void
@ -72,6 +75,7 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
GHashTableIter hit;
GType *ifaces;
gint i;
const gchar *title;
gtk_tree_store_clear (oh->priv->model);
@ -80,7 +84,10 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
interfaces = g_hash_table_new (g_str_hash, g_str_equal);
type = ((GTypeInstance*)object)->g_class->g_type;
title = (const gchar *)g_object_get_data (object, "gtk-inspector-object-title");
gtk_label_set_label (GTK_LABEL (oh->priv->object_title), title);
do
{
class_name = g_type_name (type);

View File

@ -6,7 +6,16 @@
</columns>
</object>
<template class="GtkInspectorObjectHierarchy" 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>