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
This commit is contained in:
Colin Walters 2009-10-19 18:18:14 -04:00
parent 7e7f7599b9
commit 6b5a358371

22
gdump.c
View File

@ -154,7 +154,27 @@ dump_object_type (GType type, const char *symbol, GOutputStream *out)
escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"", escaped_printf (out, " <class name=\"%s\" get-type=\"%s\"",
g_type_name (type), symbol); g_type_name (type), symbol);
if (type != G_TYPE_OBJECT) 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)) if (G_TYPE_IS_ABSTRACT (type))
escaped_printf (out, " abstract=\"1\""); escaped_printf (out, " abstract=\"1\"");