Patch to get rid of X connection, again



This is basically boc's patch again. I just made it ignore the old
'--no-gtk-init' flag which shouldn't matter as that is the default now
anyway.

It does indeed mess up GTK+, as that needs to call gtk_type_init(0) or a
lot of the signal queries seem to cause errors - missing enum types or
something. So a patch for that is here as well. (And I actually tried
it.)

So basically gtkdoc-scangobj now calls g_type_init() unless it is passed
a '--type-init-func' argument, which I think we all agreed on.

You've got 5 minutes to complain before I commit the gtk-doc patch!

Damon


Index: gtkdoc-scangobj.in
===================================================================
RCS file: /cvs/gnome/gtk-doc/gtkdoc-scangobj.in,v
retrieving revision 1.19
diff -u -r1.19 gtkdoc-scangobj.in
--- gtkdoc-scangobj.in	2002/01/18 18:31:03	1.19
+++ gtkdoc-scangobj.in	2002/01/23 23:21:04
@@ -39,15 +39,22 @@
 my $MODULE;
 my $OUTPUT_DIR;
 my $PRINT_VERSION;
+my $TYPE_INIT_FUNC="g_type_init ()";
 
+# --nogtkinit is deprecated, as it is the default now anyway.
 %optctl = (module => \$MODULE,
 	   types => \$TYPES_FILE,
 	   nogtkinit => \$NO_GTK_INIT,
+	   'type-init-func' => \$TYPE_INIT_FUNC,
 	   'output-dir' => \$OUTPUT_DIR,
 	   version => \$PRINT_VERSION);
 	   
-GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "version");
+GetOptions(\%optctl, "module=s", "types:s", "output-dir:s", "nogtkinit", "type-init-func:s", "version");
 
+if ($NO_GTK_INIT) {
+  # Do nothing. This just avoids a warning.
+}
+
 if ($PRINT_VERSION) {
     print "@VERSION \n";
     exit 0;
@@ -152,19 +159,8 @@
 int
 main (int argc, char *argv[])
 {
-EOT
+  $TYPE_INIT_FUNC;
 
-  if ($NO_GTK_INIT) {
-    print OUTPUT <<EOT;
-  g_type_init ();
-EOT
-  } else {
-    print OUTPUT <<EOT;
-  gtk_init (&argc, &argv);
-EOT
-  }
-
-print OUTPUT <<EOT;
   get_object_types ();
 
   output_signals ();
Index: Makefile.am
===================================================================
RCS file: /cvs/gnome/gtk+/docs/reference/gtk/Makefile.am,v
retrieving revision 1.31
diff -u -r1.31 Makefile.am
--- Makefile.am	2002/01/11 22:39:03	1.31
+++ Makefile.am	2002/01/23 23:28:17
@@ -9,6 +9,9 @@
 # The directory containing the source code. Relative to $(srcdir)
 DOC_SOURCE_DIR=../../../gtk
 
+#Extra options to pass to gtkdoc-scangobj
+SCANGOBJ_OPTIONS=--type-init-func="gtk_type_init(0)" 
+
 # Extra options to supply to gtkdoc-scan
 SCAN_OPTIONS=--deprecated-guards="GTK_ENABLE_BROKEN|GTK_DISABLE_DEPRECATED" 
 
@@ -198,7 +201,7 @@
 scan-build.stamp: $(HFILE_GLOB)
 	@echo '*** Scanning header files ***'
 	if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null ; then \
-	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
+	    CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" CFLAGS="$(GTKDOC_CFLAGS)" LDFLAGS="$(GTKDOC_LIBS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \
 	else \
 	    cd $(srcdir) ; \
 	    for i in $(SCANOBJ_FILES) ; do \


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