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):
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']
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
<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"/>
}
GType
-regress_test_simple_boxed_a_get_type (void)
+regress_test_simple_boxed_a_get_gtype (void)
{
static GType our_type = 0;
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),
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);