diff options
-rw-r--r-- | giscanner/ast.py | 7 | ||||
-rw-r--r-- | giscanner/transformer.py | 11 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 15 | ||||
-rw-r--r-- | tests/scanner/regress.c | 21 |
4 files changed, 48 insertions, 6 deletions
diff --git a/giscanner/ast.py b/giscanner/ast.py index 6e9dc89..53ddad2 100644 --- a/giscanner/ast.py +++ b/giscanner/ast.py @@ -88,6 +88,11 @@ in contrast to the other create_type() functions.""" fundamental = type_names.get(gtype_name) if fundamental is not None: return cls(target_fundamental=fundamental.target_fundamental) + if gtype_name == 'GHashTable': + return Map(TYPE_ANY, TYPE_ANY, gtype_name=gtype_name) + elif gtype_name in ('GArray', 'GPtrArray', 'GByteArray'): + return Array('GLib.' + gtype_name[1:], TYPE_ANY, + gtype_name=gtype_name) return cls(gtype_name=gtype_name) def get_giname(self): @@ -577,7 +582,7 @@ class Array(Type): else: assert array_type in (self.GLIB_ARRAY, self.GLIB_BYTEARRAY, - self.GLIB_PTRARRAY) + self.GLIB_PTRARRAY), array_type self.array_type = array_type assert isinstance(element_type, Type) self.element_type = element_type diff --git a/giscanner/transformer.py b/giscanner/transformer.py index 1acc67a..f9a4ead 100644 --- a/giscanner/transformer.py +++ b/giscanner/transformer.py @@ -529,14 +529,15 @@ raise ValueError.""" return ast.List(name, ast.TYPE_ANY, ctype=ctype, is_const=is_const) elif base in ('GArray', 'GPtrArray', 'GByteArray', - 'GLib.Array', 'GLib.PtrArray', 'GLib.ByteArray'): - if base in ('GArray', 'GPtrArray', 'GByteArray'): - name = 'GLib.' + base[1:] + 'GLib.Array', 'GLib.PtrArray', 'GLib.ByteArray', + 'GObject.Array', 'GObject.PtrArray', 'GObject.ByteArray'): + if '.' in base: + name = 'GLib.' + base.split('.', 1)[1] else: - name = base + name = 'GLib.' + base[1:] return ast.Array(name, ast.TYPE_ANY, ctype=ctype, is_const=is_const) - elif base in ('GHashTable', 'GLib.HashTable'): + elif base in ('GHashTable', 'GLib.HashTable', 'GObject.HashTable'): return ast.Map(ast.TYPE_ANY, ast.TYPE_ANY, ctype=ctype, is_const=is_const) return None diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index 499008a..192a7ae 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -599,6 +599,21 @@ case.</doc> </parameter> </parameters> </glib:signal> + <glib:signal name="sig-with-hash-prop"> + <doc xml:whitespace="preserve">This test signal is like TelepathyGlib's +TpAccount::status-changed</doc> + <return-value transfer-ownership="none"> + <type name="none"/> + </return-value> + <parameters> + <parameter name="object" transfer-ownership="none"> + <type name="GLib.HashTable"> + <type name="utf8"/> + <type name="GObject.Value"/> + </type> + </parameter> + </parameters> + </glib:signal> <glib:signal name="test"> <return-value transfer-ownership="none"> <type name="none"/> diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index c8d8fe6..1a7ea2c 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1800,6 +1800,7 @@ regress_test_obj_default_matrix (RegressTestObj *obj, const char *somestr) enum { REGRESS_TEST_OBJ_SIGNAL_SIG_NEW_WITH_ARRAY_PROP, + REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP, N_REGRESS_TEST_OBJ_SIGNALS }; @@ -1857,6 +1858,26 @@ regress_test_obj_class_init (RegressTestObjClass *klass) 1, G_TYPE_ARRAY); + /** + * RegressTestObj::sig-with-hash-prop: + * @self: an object + * @hash: (element-type utf8 GObject.Value): + * + * This test signal is like TelepathyGlib's + * TpAccount::status-changed + */ + regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_HASH_PROP] = + g_signal_new ("sig-with-hash-prop", + G_TYPE_FROM_CLASS (gobject_class), + G_SIGNAL_RUN_LAST, + 0, + NULL, + NULL, + g_cclosure_marshal_VOID__BOXED, + G_TYPE_NONE, + 1, + G_TYPE_HASH_TABLE); + gobject_class->set_property = regress_test_obj_set_property; gobject_class->get_property = regress_test_obj_get_property; gobject_class->dispose = regress_test_obj_dispose; |