X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/77fd2f2194af12f95959506910f3babe842c5f1f..a352a00ec1bf767c9d2655a9ecd966b03cfff24f:/src/main.c diff --git a/src/main.c b/src/main.c index 6b233d7..a3682d1 100644 --- a/src/main.c +++ b/src/main.c @@ -67,6 +67,7 @@ static int privates = 0; /* number of private data members */ static int protecteds = 0; /* number of protected methods */ static int destructors = 0; /* number of variable destructors */ static int initializers = 0; /* number of variable initializers */ +static gboolean overrode_get_type = FALSE; /* provided your won _get_type */ static gboolean made_aliases = FALSE; /* if we made any shorthand aliases and need the REALLY UGLY HACK to @@ -751,14 +752,17 @@ add_signal_prots(Method *m) "\t(*rfunc)((%s *)object", s, s, typebase); } else { const char *retcast = get_cast(m->gtktypes->data, FALSE); + gboolean is_none = (strcmp(m->gtktypes->next->data, "NONE")==0); out_printf(out, "\t___%s rfunc;\n\t" "%s *retval;\n\n" "\trfunc = (___%s)func;\n\n" "\tretval = GTK_RETLOC_%s(args[%d]);\n\n" "\t*retval = (*rfunc)((%s *)object", - s, retcast, s, (char *)m->gtktypes->data, - g_list_length(m->gtktypes)-1, typebase); + s, retcast, s, + (char *)m->gtktypes->data, + g_list_length(m->gtktypes) - (is_none ? 2 : 1), + typebase); } print_signal_marsal_args(m); @@ -818,8 +822,8 @@ add_get_type(void) "GtkType\n" "%s_get_type (void)\n" "{\n" - "\tstatic guint type = 0;\n\n" - "\tif ( ! type) {\n" + "\tstatic GtkType type = 0;\n\n" + "\tif (type == 0) {\n" "\t\tstatic const GtkTypeInfo info = {\n" "\t\t\t\"%s\",\n" "\t\t\tsizeof (%s),\n" @@ -2358,7 +2362,8 @@ print_class_block(Class *c) add_enums(c); - add_get_type(); + if ( ! overrode_get_type) + add_get_type(); if(any_method_to_alias(c)) { if( ! no_gnu) { @@ -2773,6 +2778,7 @@ main(int argc, char *argv[]) protecteds = count_protecteds((Class *)class); destructors = count_destructors((Class *)class); initializers = count_initializers((Class *)class); + overrode_get_type = find_get_type((Class *)class); make_bases(); make_inits((Class *)class);