diff options
-rw-r--r-- | giscanner/gdumpparser.py | 11 | ||||
-rw-r--r-- | giscanner/maintransformer.py | 4 | ||||
-rw-r--r-- | tests/scanner/Regress-1.0-expected.gir | 2 | ||||
-rw-r--r-- | tests/scanner/regress.c | 4 | ||||
-rw-r--r-- | tests/scanner/regress.h | 3 |
5 files changed, 15 insertions, 9 deletions
diff --git a/giscanner/gdumpparser.py b/giscanner/gdumpparser.py index eb43a5f8..7e8f31f5 100644 --- a/giscanner/gdumpparser.py +++ b/giscanner/gdumpparser.py @@ -205,7 +205,7 @@ blob containing data gleaned from GObject's primitive introspection.""" symbol = func.symbol if symbol.startswith('_'): return - elif symbol.endswith('_get_type'): + elif (symbol.endswith('_get_type') or symbol.endswith('_get_gtype')): self._initparse_get_type_function(func) def _initparse_get_type_function(self, func): @@ -306,14 +306,17 @@ blob containing data gleaned from GObject's primitive introspection.""" get_type = xmlnode.attrib['get-type'] (ns, name) = self._transformer.split_csymbol(get_type) assert ns is self._namespace - if name == 'get_type': + if name in ('get_type', '_get_gtype'): message.fatal("""The GObject name %r isn't compatibile with the configured identifier prefixes: %r The class would have no name. Most likely you want to specify a different --identifier-prefix.""" % (xmlnode.attrib['name'], self._namespace.identifier_prefixes)) - assert name.endswith('_get_type') - return (get_type, name[:-len('_get_type')]) + if name.endswith('_get_type'): + type_suffix = '_get_type' + else: + type_suffix = '_get_gtype' + return (get_type, name[:-len(type_suffix)]) def _introspect_object(self, xmlnode): type_name = xmlnode.attrib['name'] diff --git a/giscanner/maintransformer.py b/giscanner/maintransformer.py index bc795c08..dd20af1e 100644 --- a/giscanner/maintransformer.py +++ b/giscanner/maintransformer.py @@ -900,7 +900,9 @@ _split_uscored_by_type(text_buffer_try_new) -> (ast.Class(TextBuffer), 'try_new' def _pair_function(self, func): """Check to see whether a toplevel function should be a method or constructor of some type.""" - if func.symbol.endswith('_get_type') or func.symbol.startswith('_'): + if (func.symbol.endswith('_get_type') + or func.symbol.endswith('_get_gtype') + or func.symbol.startswith('_')): return (ns, subsymbol) = self._transformer.split_csymbol(func.symbol) assert ns == self._namespace diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir index c67de860..6302579d 100644 --- a/tests/scanner/Regress-1.0-expected.gir +++ b/tests/scanner/Regress-1.0-expected.gir @@ -985,7 +985,7 @@ TpAccount::status-changed</doc> <record name="TestSimpleBoxedA" c:type="RegressTestSimpleBoxedA" glib:type-name="RegressTestSimpleBoxedA" - glib:get-type="regress_test_simple_boxed_a_get_type" + glib:get-type="regress_test_simple_boxed_a_get_gtype" c:symbol-prefix="test_simple_boxed_a"> <field name="some_int" writable="1"> <type name="gint" c:type="gint"/> diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c index 7756f200..447d37cd 100644 --- a/tests/scanner/regress.c +++ b/tests/scanner/regress.c @@ -1425,7 +1425,7 @@ regress_test_simple_boxed_a_free (RegressTestSimpleBoxedA *a) } GType -regress_test_simple_boxed_a_get_type (void) +regress_test_simple_boxed_a_get_gtype (void) { static GType our_type = 0; @@ -1783,7 +1783,7 @@ regress_test_obj_class_init (RegressTestObjClass *klass) 0 /* n_params */, NULL /* param_types */); - param_types[0] = regress_test_simple_boxed_a_get_type() | G_SIGNAL_TYPE_STATIC_SCOPE; + param_types[0] = regress_test_simple_boxed_a_get_gtype() | G_SIGNAL_TYPE_STATIC_SCOPE; klass->test_signal_with_static_scope_arg = g_signal_newv ("test-with-static-scope-arg", G_TYPE_FROM_CLASS (gobject_class), diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h index 9f326405..37213548 100644 --- a/tests/scanner/regress.h +++ b/tests/scanner/regress.h @@ -251,7 +251,8 @@ struct _RegressTestSimpleBoxedA RegressTestEnum some_enum; }; -GType regress_test_simple_boxed_a_get_type (void); +/* Intentionally uses _get_gtype */ +GType regress_test_simple_boxed_a_get_gtype (void); RegressTestSimpleBoxedA *regress_test_simple_boxed_a_copy (RegressTestSimpleBoxedA *a); gboolean regress_test_simple_boxed_a_equals (RegressTestSimpleBoxedA *a, RegressTestSimpleBoxedA *other_a); |