X-Git-Url: http://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/d52e64e92557f0b6d7704077ec175c88fa7ca243..8445442abc02fc325a9ce228759403113583818c:/src/main.c diff --git a/src/main.c b/src/main.c index b4d1b27..9a9a1ac 100644 --- a/src/main.c +++ b/src/main.c @@ -120,8 +120,12 @@ gboolean no_write = FALSE; gboolean no_lines = FALSE; gboolean no_self_alias = FALSE; gboolean always_private_struct = FALSE; +gboolean gtk3_ok = FALSE; + gint prealloc = 0; + + gboolean use_m4 = FALSE; /* preprocess sources with m4 */ gboolean use_m4_clean = FALSE; /* preprocess sources with m4, no m4 flags */ char *m4_commandline = NULL; @@ -929,10 +933,10 @@ add_signal_prots(Method *m) /* hack because glib is braindamaged */ set_func = g_strdup ("g_value_set_uint"); else - set_func = g_strdup_printf ("g_value_set_%s%s", - (char *)m->gtktypes->data, + set_func = g_strdup_printf ("g_value_%s_%s", take_ownership ? - "_take_ownership" : ""); + "take" : "set", + (char *)m->gtktypes->data); gob_strdown (set_func); out_printf (out, "\n\t%s (return_value, v_return);\n", @@ -1047,17 +1051,26 @@ add_interface_inits (Class *c) char *name = replace_sep (interface, '_'); char *type = remove_sep (interface); - /* EEEK! evil, we should have some sort of option - * to force this for arbitrary interfaces, since - * some are Class and some are Iface. Glib is shite - * in consistency. */ - if (strcmp (type, "GtkEditable") == 0 || - strcmp (type, "GTypePlugin") == 0) - end = "Class"; + if(!gtk3_ok) + { + /* EEEK! evil, we should have some sort of option + * to force this for arbitrary interfaces, since + * some are Class and some are Iface. Glib is shite + * in consistency. */ + + if (strcmp (type, "GtkEditable") == 0 || + strcmp (type, "GTypePlugin") == 0) + end = "Class"; + else + // We'll assume Iface is the standard ending + end = "Iface"; + } else - /* We'll assume Iface is the standard ending */ - end = "Iface"; - + { + /*GTK3 doesn't need Iface end*/ + end="Interface"; + } + out_printf (out, "\nstatic void\n" "___%s_init (%s%s *iface)\n" "{\n", @@ -1350,14 +1363,14 @@ add_signals(Class *c) gob_strup (sig); flags = make_run_signal_flags (m, last); out_printf (out, "\tobject_signals[%s_SIGNAL] =\n" - "\t\tg_signal_new (\"%s\",\n" + "\t\tg_signal_new (%s,\n" "\t\t\tG_TYPE_FROM_CLASS (g_object_class),\n" "\t\t\t(GSignalFlags)(%s),\n" "\t\t\tG_STRUCT_OFFSET (%sClass, %s),\n" "\t\t\tNULL, NULL,\n" "\t\t\t%s,\n" "\t\t\tG_TYPE_%s, %d", - sig, m->id, + sig, m->signal_name /*m->id* if not given signal_name*/, flags, typebase, m->id, mar, (char *)m->gtktypes->data, @@ -1680,7 +1693,7 @@ make_property (Property *p) gob_strup (s); out_printf (out, "\tg_object_class_override_property (g_object_class,\n" "\t\tPROP_%s,\n" - "\t\t\"%s\");\n", s, p->name); + "\t\t\"%s\");\n", s, value_for_print (p->canonical_name, p->name) ); g_free (s); } else { GString *flags; @@ -1732,7 +1745,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "-128"), @@ -1748,7 +1761,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "0"), @@ -1762,7 +1775,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->default_value, "FALSE"), @@ -1776,7 +1789,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "G_MININT"), @@ -1792,7 +1805,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "0"), @@ -1808,7 +1821,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "G_MINLONG"), @@ -1824,7 +1837,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "0"), @@ -1840,7 +1853,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "G_MININT64"), @@ -1856,7 +1869,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "0"), @@ -1870,7 +1883,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->default_value, "0"), @@ -1885,7 +1898,7 @@ make_property (Property *p) "\t\t %s /* enum_type */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), type, @@ -1902,7 +1915,7 @@ make_property (Property *p) "\t\t %s /* flags_type */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), type, @@ -1918,7 +1931,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "-G_MAXFLOAT"), @@ -1934,7 +1947,7 @@ make_property (Property *p) "\t\t %s /* maximum */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->minimum, "-G_MAXDOUBLE"), @@ -1948,7 +1961,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* default_value */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), value_for_print (p->default_value, "NULL"), @@ -1962,7 +1975,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* param_type */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), type, @@ -1977,7 +1990,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* boxed_type */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), type, @@ -1989,7 +2002,7 @@ make_property (Property *p) "\t\t %s /* nick */,\n" "\t\t %s /* blurb */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), flags->str); @@ -2000,7 +2013,7 @@ make_property (Property *p) "\t\t %s /* nick */,\n" "\t\t %s /* blurb */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), flags->str); @@ -2013,7 +2026,7 @@ make_property (Property *p) "\t\t %s /* blurb */,\n" "\t\t %s /* object_type */,\n" "\t\t %s);\n", - p->name, + value_for_print (p->canonical_name, p->name), value_for_print (p->nick, "NULL"), value_for_print (p->blurb, "NULL"), type, @@ -4282,7 +4295,9 @@ print_help(void) "\t-o,--output-dir The directory where output " "should be placed\n" "\t--file-sep[=c] replace default \'-\' file " - "name separator\n\n"); + "name separator\n\n" + "\t--gtk3 Use gtk+3\n" + ); fprintf(stderr, "End world hunger, donate to the World Food Programme, http://www.wfp.org\n"); } @@ -4416,6 +4431,8 @@ parse_options(int argc, char *argv[]) } else { file_sep = 0; } + } else if(strcmp(argv[i], "--gtk3")==0) { + gtk3_ok = TRUE; } else if(strcmp(argv[i], "--")==0) { /*further arguments are files*/ no_opts = TRUE;