[gob] Sat Dec 14 14:55:05 2013 Jiri (George) Lebl <jirka 5z com>



commit ad0e81376ce39e895c1b31a6ca0970d7e4ffae2e
Author: Jiri (George) Lebl <jirka 5z com>
Date:   Sat Dec 14 14:55:13 2013 -0600

    Sat Dec 14 14:55:05 2013  Jiri (George) Lebl <jirka 5z com>
    
        * src/*.[ch]: apply patches from Pedro L. Lucas to implement support
          for gtk3 and add names to properties and signals
    
        * NEWS: update

 ChangeLog         |    7 ++++
 NEWS              |    6 +++
 configure.in      |    4 +-
 doc/gob2.1.in     |   26 ++++++++++++++-
 src/Makefile.am   |    4 +-
 src/lexer.l       |    9 +++++-
 src/main.c        |   91 +++++++++++++++++++++++++++++++---------------------
 src/parse.y       |   25 +++++++++++++--
 src/test.gob      |   10 ++++--
 src/treefuncs.c   |   36 +++++++++++++++++++++
 src/treefuncs.def |    2 +
 src/treefuncs.h   |    2 +
 src/util.c        |   19 +++++++++++
 src/util.h        |    1 +
 14 files changed, 192 insertions(+), 50 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e12228e..2fbbb75 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Sat Dec 14 14:55:05 2013  Jiri (George) Lebl <jirka 5z com>
+
+       * src/*.[ch]: apply patches from Pedro L. Lucas to implement support
+         for gtk3 and add names to properties and signals
+
+       * NEWS: update
+
 Tue Dec 18 21:13:09 2012  Jiri (George) Lebl <jirka 5z com>
 
        * Release 2.0.19
diff --git a/NEWS b/NEWS
index 77fe3e3..6433e2c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,9 @@
+2.0.20:
+       * Require glib 2.4, and change use of the _take_ownership functions
+         to _take_ functions
+       * Support for GTK3 (Pedro L. Lucas)
+       * names on properties and signals (Pedro L. Lucas)
+
 2.0.19:
        * Print unreftors and destructors before calling parent finalize and
          dispose as is the proper ordering (thanks to Dmitri Toubelis)
diff --git a/configure.in b/configure.in
index d5efb44..543a4c0 100644
--- a/configure.in
+++ b/configure.in
@@ -1,12 +1,12 @@
 dnl Process this file with autoconf to produce a configure script.
-AC_INIT([gob2], [2.0.19])
+AC_INIT([gob2], [2.0.20])
 AC_CONFIG_SRCDIR([src/treefuncs.h])
 AM_INIT_AUTOMAKE([dist-xz])
 
 AM_CONFIG_HEADER(config.h)
 AM_MAINTAINER_MODE
 
-GLIB_REQUIRED=2.0.0
+GLIB_REQUIRED=2.4.0
 
 dnl
 dnl  An utter hack to allow embedding of gob inside other packages.
diff --git a/doc/gob2.1.in b/doc/gob2.1.in
index 31f7bfb..f392384 100644
--- a/doc/gob2.1.in
+++ b/doc/gob2.1.in
@@ -106,6 +106,9 @@ The directory into which output should be placed.
 .B \-\-file\-sep[=c]
 Replace default \'\-\' file name separator.  If no separator character
 is given then none is used.  Only one character can be used.
+.TP
+.B \-\-gtk3
+Use gtk3.
 
 .SH TYPENAMES
 .PP
@@ -425,7 +428,9 @@ be synchronized with a private integer data member also of the name \'height\'.
 
   private int height;
   property INT height
-         (nick = _("Short nickname"),
+         (
+          name = "height",
+          nick = _("Short nickname"),
           blurb = _("Long description"),
           minimum = 10,
           maximum = 200,
@@ -440,7 +445,13 @@ of them.
 All property types have a \'nick\' and a \'blurb\' attribute and you should
 set those accordingly.  This will make runtime querying the object
 nicer as things such as gui editors and class browsers can be more
-verbose about the class itself.  You can use the \'_("string")\' notation
+verbose about the class itself.
+.PP
+The \'name\' property is canonical name of property. It is useful when you try to
+implement properties with no C names like \'vertical-scroll\'. The \'name\'
+property can be omitted.
+.PP
+You can use the \'_("string")\' notation
 instead of just "string", and that will mark the string for translation.
 .PP
 Almost all types also have a \'default_value\' attribute which sets the initial
@@ -784,6 +795,17 @@ or
 
 .fi
 .PP
+You can include name of signal, if this name is not a C variable name. Example:
+.nf
+
+  signal first INT "do-something" (POINTER, INT)
+  int do_something (self, Gtk:Widget *w (check null type), int length)
+  {
+         ...
+  }
+  
+.fi
+.PP
 If you don\'t want the wrapper that emits the signal to be public, you can
 include the keyword "private" after the "signal" keyword.  This will make
 the wrapper a normal private method.  You can also make a protected wrapper
diff --git a/src/Makefile.am b/src/Makefile.am
index e72178f..291dfb8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -61,7 +61,7 @@ EXTRA_DIST = $(BUILT_SOURCES) test.gob generate_treefuncs.pl treefuncs.def str.g
 #      test -f y.tab.h && mv -f y.tab.h parse.h
 
 test: test-object.c test-object.h
-       $(CC) -g -O -W -Wall -Wunused -Wuninitialized -Wdeclaration-after-statement -Wshadow -Wwrite-strings 
-Wunreachable-code -Wbad-function-cast -pedantic `pkg-config --cflags gobject-2.0 gtk+-2.0` -c test-object.c
+       $(CC) -g -O -W -Wall -Wunused -Wuninitialized -Wdeclaration-after-statement -Wshadow -Wwrite-strings 
-Wunreachable-code -Wbad-function-cast `pkg-config --cflags gobject-2.0 gtk+-2.0` -c test-object.c
 
 test-object.c test-object.h: test.gob gob2
        ./gob2 test.gob
@@ -69,7 +69,7 @@ test-object.c test-object.h: test.gob gob2
 # can't depend on the header file as that would break the above rule
 # since it's just for testing, who cares
 testcpp: test-object.cc
-       g++ -g -O -W -Wall -Wunused -Wuninitialized  -Wwrite-strings -Wunreachable-code -pedantic `pkg-config 
--cflags gobject-2.0 gtk+-2.0` -c test-object.cc
+       g++ -g -O -W -Wall -Wunused -Wuninitialized  -Wwrite-strings -Wunreachable-code `pkg-config --cflags 
gobject-2.0 gtk+-2.0` -c test-object.cc
 
 test-object.cc: test.gob gob2
        ./gob2 --for-cpp test.gob
diff --git a/src/lexer.l b/src/lexer.l
index 0dc3cda..d59a3d9 100644
--- a/src/lexer.l
+++ b/src/lexer.l
@@ -22,7 +22,7 @@
  */
 %{
 
-#include "config.h"
+#include "config.h" 
 #include <stdlib.h>
 #include <string.h>
 #include <ctype.h>
@@ -514,6 +514,12 @@ flags              { return FLAGS; }
 <CLASS_STRING>.        { add_to_cbuf(yytext); }
 <CLASS_STRING>\n       { add_to_cbuf(yytext); }
 
+<CLASS_CODE_I>\"       {
+                       BEGIN(CLASS_STRING);
+                       before_string = CLASS_CODE_I;
+                       add_to_cbuf(yytext);
+               }
+
 <CLASS_CODE_I,PROPERTY_CODE_I>void     {return VOID;}
 <CLASS_CODE_I,PROPERTY_CODE_I>struct   {return STRUCT;}
 <CLASS_CODE_I,PROPERTY_CODE_I>union    {return UNION;}
@@ -544,6 +550,7 @@ flags               { return FLAGS; }
                                return PROPERTY;
                        }
 <PROPERTY_CODE_I>nick  { yylval.line = line_no; return NICK; }
+<PROPERTY_CODE_I>name  { yylval.line = line_no; return NAME; }
 <PROPERTY_CODE_I>blurb { yylval.line = line_no; return BLURB; }
 <PROPERTY_CODE_I>maximum       { yylval.line = line_no; return MAXIMUM; }
 <PROPERTY_CODE_I>minimum       { yylval.line = line_no; return MINIMUM; }
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;
diff --git a/src/parse.y b/src/parse.y
index 5c8cc98..1831ad0 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -70,6 +70,7 @@ static char *onerror = NULL;
 static char *defreturn = NULL;
 
 static GList *gtktypes = NULL;
+static char *signal_name=NULL;
 
 static Property *property = NULL;
 
@@ -202,6 +203,13 @@ push_function (int scope, int method, char *oid, char *id,
        } else
                c_cbuf = NULL;
 
+       if (signal_name == NULL )
+       {
+               GString * buffer=g_string_new("");
+               g_string_printf(buffer, "\"%s\"", id);
+               signal_name = buffer->str;
+               g_string_free(buffer, FALSE);
+       }
        node = node_new (METHOD_NODE,
                         "scope", scope,
                         "method", method,
@@ -210,6 +218,7 @@ push_function (int scope, int method, char *oid, char *id,
                         "gtktypes:steal", gtktypes,
                         "flags:steal", flags,
                         "id:steal", id,
+                        "signal_name:steal", signal_name,
                         "args:steal", funcargs,
                         "funcattrs:steal", funcattrs,
                         "onerror:steal", onerror,
@@ -229,8 +238,8 @@ push_function (int scope, int method, char *oid, char *id,
                                above */
                              c_cbuf?FALSE:TRUE);
        gtktypes = NULL;
+       signal_name = NULL;
        funcargs = NULL;
-
        funcattrs = NULL;
        onerror = NULL;
        defreturn = NULL;
@@ -696,7 +705,7 @@ ensure_property (void)
 %token <cbuf> CCODE CTCODE ADCODE HTCODE PHCODE HCODE ACODE ATCODE STRING
 %token <line> PUBLIC PRIVATE PROTECTED CLASSWIDE PROPERTY ARGUMENT
 %token <line> VIRTUAL SIGNAL OVERRIDE
-%token <line> NICK BLURB MAXIMUM MINIMUM DEFAULT_VALUE ERROR FLAGS TYPE
+%token <line> NAME NICK BLURB MAXIMUM MINIMUM DEFAULT_VALUE ERROR FLAGS TYPE
 %token <line> FLAGS_TYPE ENUM_TYPE PARAM_TYPE BOXED_TYPE OBJECT_TYPE
 
 %%
@@ -1369,7 +1378,13 @@ anyval:          numtok          { $<id>$ = $<id>1; }
        |       string          { $<id>$ = $<id>1; }
        ;
 
-param_spec_value: NICK '=' string              {
+param_spec_value: NAME '=' string              {
+               ensure_property ();
+               node_set ((Node *)property,
+                         "canonical_name:steal", gob_str_delete_quotes($<id>3),
+                         NULL);
+                 }
+       |       NICK '=' string         {
                ensure_property ();
                node_set ((Node *)property,
                          "nick:steal", $<id>3,
@@ -1683,6 +1698,10 @@ fullsigtype:     scope TOKEN sigtype     {
 sigtype:       TOKEN '(' tokenlist ')'         {
                        gtktypes = g_list_prepend(gtktypes, debool ($<id>1));
                                                }
+       |       TOKEN STRING '(' tokenlist ')'          {
+                       gtktypes = g_list_prepend(gtktypes, debool ($<id>1));
+                       signal_name=$<id>2;
+                                               }
        ;
 
 tokenlist:     tokenlist ',' TOKEN             {
diff --git a/src/test.gob b/src/test.gob
index 25e2e8f..9c981eb 100644
--- a/src/test.gob
+++ b/src/test.gob
@@ -168,7 +168,9 @@ class Test:Object from /*G:Object*/ Gtk:Container
 
        private char a_property;
        property CHAR a_property
-               (nick = _("Nick"),
+               (
+                name="a-property",
+                nick = _("Nick"),
                 blurb = _("Blurb"),
                 minimum = 'a',
                 maximum = 'Z',
@@ -257,7 +259,9 @@ class Test:Object from /*G:Object*/ Gtk:Container
        init(object) {
                object->i=0;
        }
-       class_init(klass);
+       class_init(klass) {
+               /*IN CLASS INIT  */
+       }
 
        /**
         * new:
@@ -292,7 +296,7 @@ class Test:Object from /*G:Object*/ Gtk:Container
         *
         * Returns: new object
         **/
-       signal last STRING (POINTER, INT)
+       signal last STRING "bleh-signal" (POINTER, INT)
        char * bleh(self, G:Object * wid (check null type),
                        int h (check > 0)) {
                return self_blah(self,wid,h) > 0 ? g_strdup ("foo") : g_strdup ("bar");
diff --git a/src/treefuncs.c b/src/treefuncs.c
index ac2fd01..24b17e8 100644
--- a/src/treefuncs.c
+++ b/src/treefuncs.c
@@ -133,6 +133,8 @@ enum {
        QUARK_set,
        QUARK_set_STEAL,
        QUARK_set_line,
+       QUARK_canonical_name,
+       QUARK_canonical_name_STEAL,
        QUARK_nick,
        QUARK_nick_STEAL,
        QUARK_blurb,
@@ -154,6 +156,8 @@ enum {
        QUARK_mtype_STEAL,
        QUARK_gtktypes,
        QUARK_gtktypes_STEAL,
+       QUARK_signal_name,
+       QUARK_signal_name_STEAL,
        QUARK_id,
        QUARK_id_STEAL,
        QUARK_args,
@@ -243,6 +247,8 @@ ensure_quarks (void)
        g_hash_table_insert (quark_ht, "set", GINT_TO_POINTER (QUARK_set));
        g_hash_table_insert (quark_ht, "set:steal", GINT_TO_POINTER (QUARK_set_STEAL));
        g_hash_table_insert (quark_ht, "set_line", GINT_TO_POINTER (QUARK_set_line));
+       g_hash_table_insert (quark_ht, "canonical_name", GINT_TO_POINTER (QUARK_canonical_name));
+       g_hash_table_insert (quark_ht, "canonical_name:steal", GINT_TO_POINTER (QUARK_canonical_name_STEAL));
        g_hash_table_insert (quark_ht, "nick", GINT_TO_POINTER (QUARK_nick));
        g_hash_table_insert (quark_ht, "nick:steal", GINT_TO_POINTER (QUARK_nick_STEAL));
        g_hash_table_insert (quark_ht, "blurb", GINT_TO_POINTER (QUARK_blurb));
@@ -264,6 +270,8 @@ ensure_quarks (void)
        g_hash_table_insert (quark_ht, "mtype:steal", GINT_TO_POINTER (QUARK_mtype_STEAL));
        g_hash_table_insert (quark_ht, "gtktypes", GINT_TO_POINTER (QUARK_gtktypes));
        g_hash_table_insert (quark_ht, "gtktypes:steal", GINT_TO_POINTER (QUARK_gtktypes_STEAL));
+       g_hash_table_insert (quark_ht, "signal_name", GINT_TO_POINTER (QUARK_signal_name));
+       g_hash_table_insert (quark_ht, "signal_name:steal", GINT_TO_POINTER (QUARK_signal_name_STEAL));
        g_hash_table_insert (quark_ht, "id", GINT_TO_POINTER (QUARK_id));
        g_hash_table_insert (quark_ht, "id:steal", GINT_TO_POINTER (QUARK_id_STEAL));
        g_hash_table_insert (quark_ht, "args", GINT_TO_POINTER (QUARK_args));
@@ -453,6 +461,7 @@ copy_method (Method * self)
        new->otype = g_strdup (self->otype);
        new->gtktypes = g_list_copy (self->gtktypes); COPY_LIST_VALS(new->gtktypes, g_strdup);
        new->flags = g_list_copy (self->flags); COPY_LIST_VALS(new->flags, g_strdup);
+       new->signal_name = g_strdup (self->signal_name);
        new->id = g_strdup (self->id);
        new->args = node_list_copy (self->args);
        new->funcattrs = g_strdup (self->funcattrs);
@@ -480,6 +489,7 @@ copy_property (Property * self)
        new->ptype = copy_type (self->ptype);
        new->flags = g_list_copy (self->flags); COPY_LIST_VALS(new->flags, g_strdup);
        new->name = g_strdup (self->name);
+       new->canonical_name = g_strdup (self->canonical_name);
        new->nick = g_strdup (self->nick);
        new->blurb = g_strdup (self->blurb);
        new->minimum = g_strdup (self->minimum);
@@ -643,6 +653,7 @@ free_method (Method * self)
        g_free (self->otype);
        g_list_foreach (self->gtktypes, (GFunc)g_free, NULL); g_list_free (self->gtktypes);
        g_list_foreach (self->flags, (GFunc)g_free, NULL); g_list_free (self->flags);
+       g_free (self->signal_name);
        g_free (self->id);
        node_list_free (self->args);
        g_free (self->funcattrs);
@@ -662,6 +673,7 @@ free_property (Property * self)
        free_type (self->ptype);
        g_list_foreach (self->flags, (GFunc)g_free, NULL); g_list_free (self->flags);
        g_free (self->name);
+       g_free (self->canonical_name);
        g_free (self->nick);
        g_free (self->blurb);
        g_free (self->minimum);
@@ -1283,6 +1295,18 @@ setv_method (Method * self, va_list __ap)
                        self->flags = flags;
                        break;
                }
+               case QUARK_signal_name: {
+                       char * signal_name = va_arg (__ap, char *);
+                       char * __old_value = self->signal_name;
+                       self->signal_name = g_strdup (signal_name);
+                       g_free (__old_value);
+                       break;
+               }
+               case QUARK_signal_name_STEAL: {
+                       char * signal_name = va_arg (__ap, char *);
+                       self->signal_name = signal_name;
+                       break;
+               }
                case QUARK_id: {
                        char * id = va_arg (__ap, char *);
                        char * __old_value = self->id;
@@ -1456,6 +1480,18 @@ setv_property (Property * self, va_list __ap)
                        self->name = name;
                        break;
                }
+               case QUARK_canonical_name: {
+                       char * canonical_name = va_arg (__ap, char *);
+                       char * __old_value = self->canonical_name;
+                       self->canonical_name = g_strdup (canonical_name);
+                       g_free (__old_value);
+                       break;
+               }
+               case QUARK_canonical_name_STEAL: {
+                       char * canonical_name = va_arg (__ap, char *);
+                       self->canonical_name = canonical_name;
+                       break;
+               }
                case QUARK_nick: {
                        char * nick = va_arg (__ap, char *);
                        char * __old_value = self->nick;
diff --git a/src/treefuncs.def b/src/treefuncs.def
index 76e5e02..83b1d62 100644
--- a/src/treefuncs.def
+++ b/src/treefuncs.def
@@ -104,6 +104,7 @@ CLASS Property
   TYPE         ptype
   STRINGLIST   flags
   STRING       name
+  STRING       canonical_name
   STRING       nick
   STRING       blurb
   STRING       minimum
@@ -127,6 +128,7 @@ CLASS Method
   STRING       otype           # for override methods
   STRINGLIST   gtktypes        # GObject types for a signal
   STRINGLIST   flags           # G_SIGNAL_* flags for a signal
+  STRING       signal_name     # Name of signal
   STRING       id
   NODELIST     args
   STRING        funcattrs       # GLib function attribute macros
diff --git a/src/treefuncs.h b/src/treefuncs.h
index 27c7c43..325eb98 100644
--- a/src/treefuncs.h
+++ b/src/treefuncs.h
@@ -168,6 +168,7 @@ struct _Method {
        char * otype;
        GList * gtktypes;
        GList * flags;
+       char * signal_name;
        char * id;
        GList * args;
        char * funcattrs;
@@ -188,6 +189,7 @@ struct _Property {
        Type * ptype;
        GList * flags;
        char * name;
+       char * canonical_name;
        char * nick;
        char * blurb;
        char * minimum;
diff --git a/src/util.c b/src/util.c
index 86e44b8..6405190 100644
--- a/src/util.c
+++ b/src/util.c
@@ -408,6 +408,25 @@ gob_strdown (char *str)
 }
 
 char *
+gob_str_delete_quotes(char *str)
+{
+       char *p, *i;
+       p=i=str;
+       while(*p!='\0')
+       {
+               if(*p=='\"')
+               {
+                       p++;
+                       continue;
+               }
+               *i=*p;
+               p++; i++;
+       }
+       *i=*p;
+       return str;
+}
+
+char *
 make_me_type (const char *type, const char *alt)
 {
        if (type == NULL)
diff --git a/src/util.h b/src/util.h
index b4dfde5..daf6cf5 100644
--- a/src/util.h
+++ b/src/util.h
@@ -39,6 +39,7 @@ char * remove_sep(const char *base);
 char * replace_sep(const char *base, char r);
 char * gob_strup (char *s);
 char * gob_strdown (char *s);
+char * gob_str_delete_quotes(char *str);
 
 /*separate the namespace part and then replace rest of
   separators with r*/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]