GOB, Gtk3 and interfaces

"Pedro L. Lucas" <[email protected]> Thu, 3 Jan 2013 11:23:53 +0100
Newsgroups gmane.comp.gnome.devtools.gob.general
Message-ID <CAKV01JJ_4c3jzCv_d57-Wfe79sycpw+SCxNP7=QwpbkH=Ys8aw@mail.gmail.com>
Hello,

Gtk+2 ends their interfaces in "Iface". Now, Gtk+3 ends its interfaces
in "Interface". I have implemented this in GOB.

I have added the "--gtk3" option in command line (based on gob2-2.0.19 version).

I include patch with changes.

Another question, is there any repository for gob?

Thanks


--- main.c	2012-12-19 04:06:39.000000000 +0100
+++ /home/lucas/prog/gob3/gob2-2.0.19/src/main.c	2013-01-02
19:26:55.735840588 +0100
@@ -120,8 +120,12 @@
 gboolean no_lines = FALSE;
 gboolean no_self_alias = FALSE;
 gboolean always_private_struct = FALSE;
+gboolean gtk3 = 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;
@@ -1047,17 +1051,26 @@
 		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)
+		{
+			/* 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",
@@ -4282,7 +4295,9 @@
 		"\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 @@
 			} else {
 				file_sep = 0;
 			}
+		} else if(strcmp(argv[i], "--gtk3")==0) {
+			gtk3 = TRUE;
 		} else if(strcmp(argv[i], "--")==0) {
 			/*further arguments are files*/
 			no_opts = TRUE;



--
to unsubscribe:
send mail to [email protected] with "unsubscribe gob-list" in the subject