summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Holejsovsky <pholejs@src.gnome.org>2011-08-19 21:20:10 +0200
committerPavel Holejsovsky <pholejs@src.gnome.org>2011-08-25 21:22:25 +0200
commitf51eb6415dcee0656e9dec3aa19264ad2354aa06 (patch)
tree72b767eb8a725e730016c16cf25da6017e578c6b
parent2ea2bd7c18a9f9ff9293201172dfd3e83d2f5f26 (diff)
downloadgobject-introspection-f51eb6415dcee0656e9dec3aa19264ad2354aa06.tar.gz
Fix g_irepository_find_by_gtype() for GDK_TYPE_RECTANGLE
Complement fix for g-ir-scanner which converts every GdkRectangle gtype to CairoRectangleInt. Make sure that C-side API is also aware of this workaround. Use case requiring this patch: When binding implementation wants to get/set property, it can use either GI-based approach (g_property_info_xxx() funcs), or just GLib facilities. Although former is probably preferred, there are cases when latter is still needed (e.g. gstreamer uses dynamic properties, which are not present in the gir). In this case, binding implementation queries the type of the propertyb (using g_object_class_find_property()), it gets GDK_TYPE_RECTANGLE, and without the patch it cannot map it to any known type. https://bugzilla.gnome.org/show_bug.cgi?id=655423
-rw-r--r--girepository/gitypelib.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index 2e5b0e1b..dcc26511 100644
--- a/girepository/gitypelib.c
+++ b/girepository/gitypelib.c
@@ -208,6 +208,17 @@ g_typelib_get_dir_entry_by_gtype (GITypelib *typelib,
guint i;
const char *c_prefix;
+ /* There is a corner case regarding GdkRectangle. GdkRectangle is a
+ boxed type, but it is just an alias to boxed struct
+ CairoRectangleInt. Scanner automatically converts all references
+ to GdkRectangle to CairoRectangleInt, so GdkRectangle does not
+ appear in the typelibs at all, although user code might query it.
+ So if we get such query, we also change it to lookup of
+ CairoRectangleInt.
+ https://bugzilla.gnome.org/show_bug.cgi?id=655423 */
+ if (!fastpass && !strcmp (gtype_name, "GdkRectangle"))
+ gtype_name = "CairoRectangleInt";
+
/* Inside each typelib, we include the "C prefix" which acts as
* a namespace mechanism. For GtkTreeView, the C prefix is Gtk.
* Given the assumption that GTypes for a library also use the