GNOME Bugzilla – Bug 683167
g_time_zone_new not introspectable
Last modified: 2015-02-07 17:01:03 UTC
I would like to use GTimeZone in clocks, but it is not available through pygobject. For a start, it is not a boxed type, so I added the following: diff --git a/gobject/gboxed.c b/gobject/gboxed.c index 7936d45..b5c6029 100644 --- a/gobject/gboxed.c +++ b/gobject/gboxed.c @@ -144,6 +144,7 @@ G_DEFINE_BOXED_TYPE (GVariantBuilder, g_variant_builder, g_v G_DEFINE_BOXED_TYPE (GError, g_error, g_error_copy, g_error_free) G_DEFINE_BOXED_TYPE (GDateTime, g_date_time, g_date_time_ref, g_date_time_unref +G_DEFINE_BOXED_TYPE (GTimeZone, g_time_zone, g_time_zone_ref, g_time_zone_unref G_DEFINE_BOXED_TYPE (GKeyFile, g_key_file, g_key_file_ref, g_key_file_unref) G_DEFINE_BOXED_TYPE (GMainLoop, g_main_loop, g_main_loop_ref, g_main_loop_unref (END) However that does not seem to be enough and the introspection magic of glib bits is not very clear to me...
Confirming. Even after building glib with this patch and updating glib annotations in g-i, the GLib.TimeZone struct is still shown as disguised="1" and the constructor/methods are not introspectable. I had assumed that the g-ir-scanner (which links against the patched glib) would see the boxing..
Created attachment 223363 [details] [review] Box GTimeZone to make it introspectable I tested this patch, and it works. Thanks to Johan Dahlin for pointing out my previous error!
Review of attachment 223363 [details] [review]: ::: gobject/glib-types.h @@ -172,0 +172,5 @@ + * G_TYPE_TIME_ZONE: + * + * The #GType for a boxed type holding a #GTimeZone. ... 2 more ... this needs to be 2.34, no?
Review of attachment 223363 [details] [review]: ::: docs/reference/gobject/gobject-sections.txt @@ -390,2 +390,3 @@ g_error_get_type g_date_time_get_type +g_time_zone_get_type you also need to add G_TYPE_TIME_ZONE above near G_TYPE_DATE_TIME
(In reply to comment #3) > Review of attachment 223363 [details] [review]: > > ::: gobject/glib-types.h > @@ -172,0 +172,5 @@ > + * G_TYPE_TIME_ZONE: > + * > + * The #GType for a boxed type holding a #GTimeZone. > ... 2 more ... > > this needs to be 2.34, no? Hm, I'm not sure. The GTimeZone API itself exists since 2.26 according to glib/gtimezone.c, that's where I took the number from. Technically, _time_zone_get_type() has existed since then, but not as public API. So if 2.34 is more appropriate, I'm happy to change it to this. > you also need to add G_TYPE_TIME_ZONE above near G_TYPE_DATE_TIME Ah yes, thanks for spotting.
> > > > this needs to be 2.34, no? > > Hm, I'm not sure. The GTimeZone API itself exists since 2.26 according to > glib/gtimezone.c, that's where I took the number from. Technically, > _time_zone_get_type() has existed since then, but not as public API. So if 2.34 > is more appropriate, I'm happy to change it to this. I vote for 2.34
Created attachment 223606 [details] [review] Box GTimeZone to make it introspectable This time with 10% more love!
Review of attachment 223606 [details] [review]: ok
Comment on attachment 223606 [details] [review] Box GTimeZone to make it introspectable Pushed. For everyone trying this, please note that you need to rebuild g-i against this glib installation for the girs to pick up this change.
*** Bug 676922 has been marked as a duplicate of this bug. ***
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]