summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2014-05-08 01:59:37 -0400
committerMatthias Clasen <mclasen@redhat.com>2014-05-10 22:04:24 -0400
commite87addd9ae6b4b107768a2a1096b5ccd8ac22dc6 (patch)
tree34b9035718f6713b8cc04725c871a47ceab322f7 /modules
parentbf9d22f10fd13e6946fe4565a73f8624653c9a6d (diff)
downloadgtk+-e87addd9ae6b4b107768a2a1096b5ccd8ac22dc6.tar.gz
inspector: Show interfaces in the object hierarchy
This gives a more complete picture.
Diffstat (limited to 'modules')
-rw-r--r--modules/inspector/object-hierarchy.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/modules/inspector/object-hierarchy.c b/modules/inspector/object-hierarchy.c
index 71af2bf78d..50ce6b2d58 100644
--- a/modules/inspector/object-hierarchy.c
+++ b/modules/inspector/object-hierarchy.c
@@ -62,21 +62,42 @@ void
gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
GObject *object)
{
- GObjectClass *klass = G_OBJECT_GET_CLASS (object);
+ GType type;
const gchar *class_name;
GtkTreeIter iter, parent;
- GSList *list = NULL, *l;
+ GList *list = NULL, *l;
+ GHashTable *interfaces;
+ GHashTableIter hit;
+ GType *ifaces;
+ gint i;
gtk_tree_store_clear (oh->priv->model);
+ interfaces = g_hash_table_new (g_str_hash, g_str_equal);
+ type = ((GTypeInstance*)object)->g_class->g_type;
+
do
{
- class_name = G_OBJECT_CLASS_NAME (klass);
- list = g_slist_append (list, (gpointer)class_name);
+ class_name = g_type_name (type);
+ list = g_list_append (list, (gpointer)class_name);
+ ifaces = g_type_interfaces (type, NULL);
+ for (i = 0; ifaces[i]; i++)
+ g_hash_table_add (interfaces, (gchar *)g_type_name (ifaces[i]));
+ g_free (ifaces);
}
- while ((klass = g_type_class_peek_parent (klass)));
- list = g_slist_reverse (list);
+ while ((type = g_type_parent (type)));
+ g_hash_table_iter_init (&hit, interfaces);
+ while (g_hash_table_iter_next (&hit, (gpointer *)&class_name, NULL))
+ {
+ gtk_tree_store_append (oh->priv->model, &iter, NULL);
+ gtk_tree_store_set (oh->priv->model, &iter,
+ COLUMN_OBJECT_NAME, class_name,
+ -1);
+ }
+ g_hash_table_unref (interfaces);
+
+ list = g_list_reverse (list);
for (l = list; l; l = l->next)
{
gtk_tree_store_append (oh->priv->model, &iter, l == list ? NULL : &parent);
@@ -86,7 +107,7 @@ gtk_inspector_object_hierarchy_set_object (GtkInspectorObjectHierarchy *oh,
parent = iter;
}
- g_slist_free (list);
+ g_list_free (list);
gtk_tree_view_expand_all (oh->priv->tree);
gtk_tree_selection_select_iter (gtk_tree_view_get_selection (oh->priv->tree), &iter);