[gobject-introspection] Fix g_irepository_find_by_gtype() for GDK_TYPE_RECTANGLE
- From: Pavel Holejsovsky <pholejs src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection] Fix g_irepository_find_by_gtype() for GDK_TYPE_RECTANGLE
- Date: Thu, 25 Aug 2011 19:22:51 +0000 (UTC)
commit f51eb6415dcee0656e9dec3aa19264ad2354aa06
Author: Pavel Holejsovsky <pholejs src gnome org>
Date: Fri Aug 19 21:20:10 2011 +0200
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
girepository/gitypelib.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/girepository/gitypelib.c b/girepository/gitypelib.c
index 2e5b0e1..dcc2651 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]