diff options
author | Colin Walters <walters@verbum.org> | 2009-10-19 18:18:14 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-10-21 14:19:26 -0400 |
commit | 0d9cfb004d528fd0a7a0b05943db3b2097d8a085 (patch) | |
tree | 4ff2d7c08d762c0ee28e3625cc28af5db743ba7c /girepository/gdump.c | |
parent | f152f5e97df7783c61907b5f201840afbd46331f (diff) | |
download | gobject-introspection-0d9cfb004d528fd0a7a0b05943db3b2097d8a085.tar.gz |
Use best known derived parent
In the case where a known class derives from a hidden one, we want
to use the most-derived parent class, rather than simply falling back
to GObject.
Example:
ShellEmbedWidget in gnome-shell derives from ClutterGLXTexturePixmap from clutter,
which is a hidden class. ClutterGLXTexturePixmap's parent itself is
ClutterX11TexturePixmap, which is also hidden. But its parent is
ClutterTexture, which we do know. Use that.
https://bugzilla.gnome.org/show_bug.cgi?id=598993
Diffstat (limited to 'girepository/gdump.c')
-rw-r--r-- | girepository/gdump.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/girepository/gdump.c b/girepository/gdump.c index 519672aa..b4a3e8eb 100644 --- a/girepository/gdump.c +++ b/girepository/gdump.c @@ -154,7 +154,27 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out) escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"", g_type_name (type), symbol); if (type != G_TYPE_OBJECT) - escaped_printf (out, " parent=\"%s\"", g_type_name (g_type_parent (type))); + { + GString *parent_str; + GType parent; + gboolean first = TRUE; + + parent = type; + parent_str = g_string_new (""); + do + { + parent = g_type_parent (parent); + if (first) + first = FALSE; + else + g_string_append_c (parent_str, ','); + g_string_append (parent_str, g_type_name (parent)); + } while (parent != G_TYPE_OBJECT && parent != G_TYPE_INVALID); + + escaped_printf (out, " parents=\"%s\"", parent_str->str); + + g_string_free (parent_str, TRUE); + } if (G_TYPE_IS_ABSTRACT (type)) escaped_printf (out, " abstract=\"1\""); |