GNOME Bugzilla – Bug 645792
Pango.Context is missing some methods via gobject introspection
Last modified: 2012-08-25 19:05:42 UTC
Some methods of Pango.Context do not show up in Python when using gobject instrospection. Python 3.1.2 (r312:79147, Mar 2 2011, 17:43:12) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from gi.repository import Pango >>> c = Pango.Context() >>> dir(c) ['__class__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__gdoc__', '__ge__', '__getattribute__', '__gobject_init__', '__grefcount__', '__gt__', '__gtype__', '__hash__', '__info__', '__init__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'chain', 'connect', 'connect_after', 'connect_object', 'connect_object_after', 'disconnect', 'disconnect_by_func', 'emit', 'emit_stop_by_name', 'freeze_notify', 'get_base_dir', 'get_base_gravity', 'get_data', 'get_font_description', 'get_gravity', 'get_gravity_hint', 'get_language', 'get_matrix', 'get_metrics', 'get_properties', 'get_property', 'handler_block', 'handler_block_by_func', 'handler_disconnect', 'handler_is_connected', 'handler_unblock', 'handler_unblock_by_func', 'list_families', 'new', 'notify', 'props', 'set_base_dir', 'set_base_gravity', 'set_data', 'set_font_description', 'set_font_map', 'set_gravity_hint', 'set_language', 'set_matrix', 'set_properties', 'set_property', 'stop_emission', 'thaw_notify', 'weak_ref'] This list is missing 'load_font', which is rather important, and also several others. The missing methods appear to be marked with introspectable="0" in the Pango-1.0.gir file. But I don't know why that's there, since all the relevant type information seems to be present in the .gir entry.
The cause is missing (transfer) annotations on return types. Relevant warnings from g-ir-scanner: pango-context.c:230: Warning: Pango: pango_context_get_font_map: return value: Missing (transfer) annotation pango-context.c:283: Warning: Pango: pango_context_load_font: return value: Missing (transfer) annotation pango-context.c:303: Warning: Pango: pango_context_load_fontset: return value: Missing (transfer) annotation
Can you test with master and submit a patch?
Created attachment 186246 [details] [review] Patches to fix missing return type annotations in pango-context.c for gobject introspection I'm assuming that (transfer full) is the right annotation. Someone with better knowledge of gobject introspection may want to review this.
These have been fixed in the mean time.