Re: [glade--]Re: Gnomemm-2 support in glade--



On Mon, 2002-11-04 at 11:55, Christof Petig wrote:
> Hi Peter,
> 
> perhaps I should express my opinion on a GNOME1 and a GNOME2 macro (see 
> GTKMM1 in Configuration.hh). I'd like to see the switch replaced by a if 
> (GNOME1). This is
> - much less overhead (read: characters to type/read)
> - much more readable
> since we only have to support 2 versions.
> 
> Would you mind to remove the environment variable? Or do you still see a 
> need for it (given my explanations on which version to select).
> 
> Yours
>    Christof

Dear Christof and all on glademm-list,

Still hacking on Gnome2 / glademm...
I downloaded the CVS on 16th November, and applied my latest patches.

I have a number of things to suggest. Forgive me if I have
misunderstood your design...

(0) When you replaced the switch() with if() in Cxx.cc, you overlooked
the break; at the end of the default section... This breaks the
Gnome 1 code generation.

(1) In configure.in, I test separately for the versions of the GTK,
GTK2, Gnome, Gnome2, and Bonobo libraries. I expect most developers
will have for some time parallel installations of Gnome 1 and 2, and
may need to develop Gnome1 applications for backward compatibility;
what is detected on the developer's system may have little in common
with the platform where the generated code is to run.

(2) I've gone with your single gnome2 flag and GNOME2 macro. Also I
agree it's reasonable to set gnome2 by default if a Glade 2 file is
read. But for the reason set out in (1), I think the GNOME1/GNOME2
macros should test the Configuration.gnome2 flag, rather than looking
at package versions.

(3) I ran into problems with my GnomeApp example, and I'm not sure
which way to proceed. Glade-2 (1.1.2) exposes certain internal widgets
of a Gnome App: namely

  <child internal-child="dock">
    <widget class="BonoboDock" id="bonobodock1">
      <child>
	<widget class="BonoboDockItem" id="bonobodockitem1">
	  <child>
	    <widget class="GtkMenuBar" id="menubar1">
	      ...

The question is, should glademm

(a) try to manipulate the BonoboDockItems directly, using the
libbonobouimm bindings.

... or ...

(b) try to figure out the function of each BonoboDockItem and use the
libgnomeuimm methods set_menus() and set_toolbar() when appropriate.

I've tried (a); the advantage is you don't need to know about the
special methods for handling menus and toolbars, you just do exactly
what it says in the Glade-2 file. In fact, this is what glademm does
for Gnome1, with GnomeDockItems instead of BonoboDockItems. The
disadvantage is you need the libbonobouimm bindings, which I think are
still not very stable. Unfortunately I needed to add a call to
Gnome::Bonobo::wrap_init() at startup; this shouldn't be necessary
in the long term but libgnomeuimm doesn't do it (there's a FIXME
comment in the code there, though).

Here are some more patches for you to look at...

Peter

-- 
       Home:                           Work:
Email: prw wainpr demon co uk          peter wainwright nrpb org
Fax:   +44-870-0523185                 +44-1235-822656
Web:   http://www.wainpr.demon.co.uk   http://www.nrpb.org
diff -U3 -r glademm-old/acconfig.h glademm/acconfig.h
--- glademm-old/acconfig.h	Fri Feb  9 11:35:01 2001
+++ glademm/acconfig.h	Sun Nov 17 13:34:04 2002
@@ -6,10 +6,28 @@
 #undef GTKMM_MAJOR
 #undef GTKMM_MINOR
 #undef GTKMM_MICRO
+#undef GTKMM2_MAJOR
+#undef GTKMM2_MINOR
+#undef GTKMM2_MICRO
 #undef GTK_MAJOR
 #undef GTK_MINOR
 #undef GTK_MICRO
+#undef GTK2_MAJOR
+#undef GTK2_MINOR
+#undef GTK2_MICRO
 #undef HAS_REAL_NAME
 #undef GNOMEMM_MAJOR
 #undef GNOMEMM_MINOR
 #undef GNOMEMM_MICRO
+#undef LIBGNOMEMM_MAJOR
+#undef LIBGNOMEMM_MINOR
+#undef LIBGNOMEMM_MICRO
+#undef LIBGNOMEUIMM_MAJOR
+#undef LIBGNOMEUIMM_MINOR
+#undef LIBGNOMEUIMM_MICRO
+#undef LIBBONOBOMM_MAJOR
+#undef LIBBONOBOMM_MINOR
+#undef LIBBONOBOMM_MICRO
+#undef LIBBONOBOUIMM_MAJOR
+#undef LIBBONOBOUIMM_MINOR
+#undef LIBBONOBOUIMM_MICRO
diff -U3 -r glademm-old/configure.in glademm/configure.in
--- glademm-old/configure.in	Sat Nov 16 17:37:16 2002
+++ glademm/configure.in	Sun Nov 17 13:34:04 2002
@@ -142,8 +142,6 @@
 ])
 
 AC_MSG_CHECKING(installed gtk version)
-GMM_PARSE_VERSION(GTK,`pkg-config --silence-errors --modversion gtk+-2.0`)
-GMM_PARSE_VERSION(GTK,`pkg-config --silence-errors --modversion gtk+`)
 GMM_PARSE_VERSION(GTK,`gtk-config --version`)
 if test -z "$GTK_MAJOR" 
 then
@@ -155,8 +153,20 @@
 AC_DEFINE_UNQUOTED(GTK_MINOR,$GTK_MINOR)
 AC_DEFINE_UNQUOTED(GTK_MICRO,$GTK_MICRO)
 
+AC_MSG_CHECKING(installed gtk2 version)
+GMM_PARSE_VERSION(GTK2,`pkg-config --silence-errors --modversion gtk+-2.0`)
+GMM_PARSE_VERSION(GTK2,`pkg-config --silence-errors --modversion gtk+`)
+if test -z "$GTK2_MAJOR" 
+then
+  	AC_MSG_WARN([Can't determine your gtk2 version, assuming])
+  	GTK2_MAJOR=1 ; GTK2_MINOR=3 ; GTK2_MICRO=0
+fi
+AC_MSG_RESULT([$GTK2_MAJOR.$GTK2_MINOR.$GTK2_MICRO])
+AC_DEFINE_UNQUOTED(GTK2_MAJOR,$GTK2_MAJOR)
+AC_DEFINE_UNQUOTED(GTK2_MINOR,$GTK2_MINOR)
+AC_DEFINE_UNQUOTED(GTK2_MICRO,$GTK2_MICRO)
+
 AC_MSG_CHECKING(installed gtkmm version)
-GMM_PARSE_VERSION(GTKMM,`pkg-config --silence-errors --modversion gtkmm-2.0`)
 GMM_PARSE_VERSION(GTKMM,`gtkmm-config --version`)
 if test -z "$GTKMM_MAJOR" 
 then
@@ -168,6 +178,17 @@
 AC_DEFINE_UNQUOTED(GTKMM_MINOR,$GTKMM_MINOR)
 AC_DEFINE_UNQUOTED(GTKMM_MICRO,$GTKMM_MICRO)
 
+GMM_PARSE_VERSION(GTKMM2,`pkg-config --silence-errors --modversion gtkmm-2.0`)
+if test -z "$GTKMM2_MAJOR" 
+then
+  	AC_MSG_WARN([Can't determine your gtkmm2 version, assuming])
+  	GTKMM2_MAJOR=1 ; GTKMM2_MINOR=3 ; GTKMM2_MICRO=0
+fi
+AC_MSG_RESULT([$GTKMM2_MAJOR.$GTKMM2_MINOR.$GTKMM2_MICRO])
+AC_DEFINE_UNQUOTED(GTKMM2_MAJOR,$GTKMM2_MAJOR)
+AC_DEFINE_UNQUOTED(GTKMM2_MINOR,$GTKMM2_MINOR)
+AC_DEFINE_UNQUOTED(GTKMM2_MICRO,$GTKMM2_MICRO)
+
 if test ! "x$ac_domainname_standard" = "x" -a ! "x$ac_domainname_gnusrc" = "x" ; then
 AC_MSG_CHECKING(whether utsname contains domainname when __USE_GNU is set)
 AC_TRY_COMPILE(
@@ -190,37 +211,62 @@
 AC_MSG_CHECKING(for gnome-- version)
 # --modversion gnomemm might work as well but gives less 
 # 	information if it fails
-MODULE_VERSION="`pkg-config --modversion libgnomemm-2.0`"
-if test "$MODULE_VERSION" != ""; then
-    GMM_PARSE_VERSION(GNOMEMM,$MODULE_VERSION)
-    AC_MSG_RESULT([$GNOMEMM_MAJOR.$GNOMEMM_MINOR.$GNOMEMM_MICRO])
-    AC_DEFINE_UNQUOTED(GNOMEMM_MAJOR,$GNOMEMM_MAJOR)
-    AC_DEFINE_UNQUOTED(GNOMEMM_MINOR,$GNOMEMM_MINOR)
-    AC_DEFINE_UNQUOTED(GNOMEMM_MICRO,$GNOMEMM_MICRO)
-else
-    gnomelib=`gnome-config --libdir`
-    if test "x$gnomelib" = "x" ; then
-	AC_MSG_RESULT(gnome-config not found)
-    elif test -r "$gnomelib/gnomemmConf.sh" 
+gnomelib=`gnome-config --libdir`
+if test "x$gnomelib" = "x" ; then
+    AC_MSG_RESULT(gnome-config not found)
+elif test -r "$gnomelib/gnomemmConf.sh" 
+then
+    source $gnomelib/gnomemmConf.sh
+    if test "x$MODULE_VERSION" = "x"
     then
-	source $gnomelib/gnomemmConf.sh
-	if test "x$MODULE_VERSION" = "x"
-	then
-	    AC_MSG_RESULT(no version info available)
-	else
-	    # pkg-config for 2.0?
-	    MODULE_VERSION=`echo "$MODULE_VERSION" | sed 's/gnomemm-//'`
-	    GMM_PARSE_VERSION(GNOMEMM,$MODULE_VERSION)
-	    AC_MSG_RESULT([$GNOMEMM_MAJOR.$GNOMEMM_MINOR.$GNOMEMM_MICRO])
-	    AC_DEFINE_UNQUOTED(GNOMEMM_MAJOR,$GNOMEMM_MAJOR)
-	    AC_DEFINE_UNQUOTED(GNOMEMM_MINOR,$GNOMEMM_MINOR)
-	    AC_DEFINE_UNQUOTED(GNOMEMM_MICRO,$GNOMEMM_MICRO)
-	fi
+	AC_MSG_RESULT(no version info available)
     else
-	AC_MSG_RESULT(gnomemmConf.sh not found)
+	# pkg-config for 2.0?
+	MODULE_VERSION=`echo "$MODULE_VERSION" | sed 's/gnomemm-//'`
+	GMM_PARSE_VERSION(GNOMEMM,$MODULE_VERSION)
+	AC_MSG_RESULT([$GNOMEMM_MAJOR.$GNOMEMM_MINOR.$GNOMEMM_MICRO])
+	AC_DEFINE_UNQUOTED(GNOMEMM_MAJOR,$GNOMEMM_MAJOR)
+	AC_DEFINE_UNQUOTED(GNOMEMM_MINOR,$GNOMEMM_MINOR)
+	AC_DEFINE_UNQUOTED(GNOMEMM_MICRO,$GNOMEMM_MICRO)
     fi
+else
+    AC_MSG_RESULT(gnomemmConf.sh not found)
 fi
 
+MODULE_VERSION="`pkg-config --modversion libgnomemm-2.0`"
+if test "$MODULE_VERSION" != ""; then
+    GMM_PARSE_VERSION(LIBGNOMEMM,$MODULE_VERSION)
+    AC_MSG_RESULT([$LIBGNOMEMM_MAJOR.$LIBGNOMEMM_MINOR.$LIBGNOMEMM_MICRO])
+    AC_DEFINE_UNQUOTED(LIBGNOMEMM_MAJOR,$LIBGNOMEMM_MAJOR)
+    AC_DEFINE_UNQUOTED(LIBGNOMEMM_MINOR,$LIBGNOMEMM_MINOR)
+    AC_DEFINE_UNQUOTED(LIBGNOMEMM_MICRO,$LIBGNOMEMM_MICRO)
+fi
+MODULE_VERSION="`pkg-config --modversion libgnomeuimm-2.0`"
+if test "$MODULE_VERSION" != ""; then
+    GMM_PARSE_VERSION(LIBGNOMEUIMM,$MODULE_VERSION)
+    AC_MSG_RESULT([$LIBGNOMEUIMM_MAJOR.$LIBGNOMEUIMM_MINOR.$LIBGNOMEUIMM_MICRO])
+    AC_DEFINE_UNQUOTED(LIBGNOMEUIMM_MAJOR,$LIBGNOMEUIMM_MAJOR)
+    AC_DEFINE_UNQUOTED(LIBGNOMEUIMM_MINOR,$LIBGNOMEUIMM_MINOR)
+    AC_DEFINE_UNQUOTED(LIBGNOMEUIMM_MICRO,$LIBGNOMEUIMM_MICRO)
+fi
+
+MODULE_VERSION="`pkg-config --modversion libbonobomm-2.0`"
+if test "$MODULE_VERSION" != ""; then
+    GMM_PARSE_VERSION(LIBBONOBOMM,$MODULE_VERSION)
+    AC_MSG_RESULT([$LIBBONOBOMM_MAJOR.$LIBBONOBOMM_MINOR.$LIBBONOBOMM_MICRO])
+    AC_DEFINE_UNQUOTED(LIBBONOBOMM_MAJOR,$LIBBONOBOMM_MAJOR)
+    AC_DEFINE_UNQUOTED(LIBBONOBOMM_MINOR,$LIBBONOBOMM_MINOR)
+    AC_DEFINE_UNQUOTED(LIBBONOBOMM_MICRO,$LIBBONOBOMM_MICRO)
+fi
+MODULE_VERSION="`pkg-config --modversion libbonobouimm-2.0`"
+if test "$MODULE_VERSION" != ""; then
+    GMM_PARSE_VERSION(LIBBONOBOUIMM,$MODULE_VERSION)
+    AC_MSG_RESULT([$LIBBONOBOUIMM_MAJOR.$LIBBONOBOUIMM_MINOR.$LIBBONOBOUIMM_MICRO])
+    AC_DEFINE_UNQUOTED(LIBBONOBOUIMM_MAJOR,$LIBBONOBOUIMM_MAJOR)
+    AC_DEFINE_UNQUOTED(LIBBONOBOUIMM_MINOR,$LIBBONOBOUIMM_MINOR)
+    AC_DEFINE_UNQUOTED(LIBBONOBOUIMM_MICRO,$LIBBONOBOUIMM_MICRO)
+fi
+ 
 myprefix="$prefix"
 if test "$myprefix" = "NONE" ; then myprefix=$ac_default_prefix ; fi
 myprefix="\"$myprefix\""
diff -U3 -r glademm-old/src/Configuration.hh glademm/src/Configuration.hh
--- glademm-old/src/Configuration.hh	Sat Nov 16 17:37:17 2002
+++ glademm/src/Configuration.hh	Sun Nov 17 13:34:04 2002
@@ -98,10 +98,14 @@
    int verbose;
    Pkg_Version pc_version;
    Pkg_Version gtk_version;
+   Pkg_Version gtk2_version;
    Pkg_Version gtkmm_version;
+   Pkg_Version gtkmm2_version;
    Pkg_Version gnomemm_version;
    Pkg_Version libgnomemm_version;
    Pkg_Version libgnomeuimm_version;
+   Pkg_Version libbonobomm_version;
+   Pkg_Version libbonobouimm_version;
    std::string template_postfix;
    std::string source_suffix, header_suffix;
    
@@ -122,10 +126,24 @@
      need_notebook_hack(false), gnome2(false),
      verbose(0),
      gtk_version(GTK_MAJOR,GTK_MINOR,GTK_MICRO,Pkg_Version::Glademm_Compile_Time),
+     gtk2_version(GTK2_MAJOR,GTK2_MINOR,GTK2_MICRO,Pkg_Version::Glademm_Compile_Time),
      gtkmm_version(GTKMM_MAJOR,GTKMM_MINOR,GTKMM_MICRO,Pkg_Version::Glademm_Compile_Time),
+     gtkmm2_version(GTKMM2_MAJOR,GTKMM2_MINOR,GTKMM2_MICRO,Pkg_Version::Glademm_Compile_Time),
 #ifdef GNOMEMM_MAJOR     
      gnomemm_version(GNOMEMM_MAJOR,GNOMEMM_MINOR,GNOMEMM_MICRO,Pkg_Version::Glademm_Compile_Time),
 #endif     
+#ifdef LIBGNOMEMM_MAJOR     
+     libgnomemm_version(LIBGNOMEMM_MAJOR,LIBGNOMEMM_MINOR,LIBGNOMEMM_MICRO,Pkg_Version::Glademm_Compile_Time),
+#endif     
+#ifdef LIBGNOMEUIMM_MAJOR     
+     libgnomeuimm_version(LIBGNOMEUIMM_MAJOR,LIBGNOMEUIMM_MINOR,LIBGNOMEUIMM_MICRO,Pkg_Version::Glademm_Compile_Time),
+#endif     
+#ifdef LIBBONOBOMM_MAJOR     
+     libbonobomm_version(LIBBONOBOMM_MAJOR,LIBBONOBOMM_MINOR,LIBBONOBOMM_MICRO,Pkg_Version::Glademm_Compile_Time),
+#endif     
+#ifdef LIBBONOBOUIMM_MAJOR     
+     libbonobouimm_version(LIBBONOBOUIMM_MAJOR,LIBBONOBOUIMM_MINOR,LIBBONOBOUIMM_MICRO,Pkg_Version::Glademm_Compile_Time),
+#endif     
      // had been "_glade"
      template_postfix("_new"),
      source_suffix(".cc"), header_suffix(".hh"),
@@ -136,12 +154,14 @@
 	const std::string GtkmmIncludePath() const throw();
 	const std::string GnomemmIncludePath() const throw();
 	const std::string GnomeUImmIncludePath() const throw();
+	const std::string BonobommIncludePath() const throw();
+	const std::string BonoboUImmIncludePath() const throw();
 };
 
 extern struct Configuration Configuration;
 
 #define GTKMM1 (Configuration.gtkmm_version<Pkg_Version(1,3,0))
 #define GTKMM2 (Configuration.gtkmm_version>=Pkg_Version(1,3,0))
-#define GNOME1 (Configuration.gnomemm_version<Pkg_Version(1,3,0))
-#define GNOME2 (Configuration.gnomemm_version>=Pkg_Version(1,3,0))
+#define GNOME1 (!Configuration.gnome2)
+#define GNOME2 (Configuration.gnome2)
 #endif
diff -U3 -r glademm-old/src/Cxx.cc glademm/src/Cxx.cc
--- glademm-old/src/Cxx.cc	Sat Nov 16 17:37:18 2002
+++ glademm/src/Cxx.cc	Sun Nov 17 14:20:25 2002
@@ -273,8 +273,14 @@
 	    // We could be lazy and include libgnomeuimm.h...
 	    f.Include(Configuration.GnomemmIncludePath()+"main.h");
 	    // For module_info_get()
-	    if (GNOME2)
+	    if (GNOME2) {
 	       f.Include(Configuration.GnomeUImmIncludePath()+"init.h");
+	       // FIXME: This is a kludge. Until the day libgnomeuimm
+	       // properly initializes bonobouimm (there's a FIXME in
+	       // the source there), we need to call wrap_init()
+	       // ourself.
+	       f.Include("bonobomm/widgets/wrap_init.h");
+	    }
 	    if (Configuration.gettext_support)
 	       f.Include("libgnome/gnome-i18n.h");
 	 }
@@ -339,7 +345,6 @@
 		  f << "\n"
 		     "CXXFLAGS=$(CXXFLAGS) "<< ENABLE_NLS <<"$(shell gtkmm-config --cflags) $(shell libglade-config --cflags "<<gnome<<")\n"
 		     "LIBS=$(shell echo $$LIBS) $(shell gtkmm-config --libs) "<<lgnomemm<<" $(shell libtool-config --libs "<<gnome<<')';
-		  break;
 	       }
             }
    	    else if (Configuration.gnome_support) {
@@ -347,13 +352,13 @@
 	       {  f << "\n"
 		     "CXXFLAGS=$(CXXFLAGS) "<< ENABLE_NLS <<"$(shell pkg-config --cflags gtkmm-2.0) $(shell pkg-config --cflags libgnomemm-2.0 libgnomeuimm-2.0)\n"
 		     "LIBS=$(shell echo $$LIBS) $(shell pkg-config --libs gtkmm-2.0) $(shell pkg-config --libs libgnomemm-2.0 libgnomeuimm-2.0)";
+	          // FIXME: Need to detect if we need libbonobomm
 	       }
 	       else
 	       {
 		  f << "\n"
 		     "CXXFLAGS=$(CXXFLAGS) "<< ENABLE_NLS <<"$(shell gtkmm-config --cflags) $(shell gnome-config --cflags gnomemm gnomeui)\n"
 		     "LIBS=$(shell echo $$LIBS) $(shell gtkmm-config --libs) $(shell gnome-config --libs gnomemm gnomeui)";
-		  break;
 	       }
 	    }
    	    else {
@@ -366,7 +371,6 @@
 	       {  f << "\n"
 		     "CXXFLAGS=$(CXXFLAGS) $(shell gtkmm-config --cflags)\n"
 		     "LIBS=$(shell echo $$LIBS) $(shell gtkmm-config --libs)";
-		  break;
 	       }
 	    }
             f << "\n"
@@ -489,6 +493,7 @@
 		   "GNOMEMM_LIBS=\"`pkg-config --libs libgnomemm-2.0 libgnomeuimm-2.0`\"\n"
 		   "AC_SUBST(GNOMEMM_CFLAGS)\n"
 		   "AC_SUBST(GNOMEMM_LIBS)\n";
+	      // FIXME: Need to detect if we need libbonobomm, libbonobouimm
           }
           else
           {   f << "# GNOME-CONFIG script knows about gnomemm:\n"
@@ -499,7 +504,6 @@
 		   "AC_SUBST(GNOMEMM_LIBS)\n";
 		// perhaps separate into GNOMEMM_LIBDIR and GNOMEMM_LIBS ?
 		// we should really test gnomemm!!!
-	      break;
 	   }
 	 }
 	 f << "\n";
@@ -742,6 +746,11 @@
 			       << "PACKAGE, VERSION, "
 			       << WriterBase::GnomeUIPrefix()+"module_info_get(), "
 			       << "argc, argv)";
+	       // FIXME: This is a kludge. Until the day libgnomeuimm
+	       // properly initializes bonobouimm (there's a FIXME in
+	       // the source there), we need to call wrap_init()
+	       // ourself.
+	       f.Statement("Gnome::Bonobo::wrap_init()");
             }
             else
             {
diff -U3 -r glademm-old/src/Naming.cc glademm/src/Naming.cc
--- glademm-old/src/Naming.cc	Sat Nov 16 17:37:18 2002
+++ glademm/src/Naming.cc	Sun Nov 17 13:34:04 2002
@@ -299,7 +299,7 @@
 #undef GTKMM2
 #undef GNOME2
 #define GTKMM2 (gtkmm_version>=Pkg_Version(1,3,0))
-#define GNOME2 (gnomemm_version>=Pkg_Version(1,3,0))
+#define GNOME2 (gnome2)
 
 const std::string Configuration::GtkmmIncludePath() const throw()
 {  if (GTKMM2) return "gtkmm/";
@@ -314,3 +314,11 @@
 {  return GNOME2 ? "libgnomemm/" : "gnome--/";
 }
 
+const std::string Configuration::BonobommIncludePath() const throw()
+{  return "bonobomm/";
+}
+
+const std::string Configuration::BonoboUImmIncludePath() const throw()
+{  return "bonobomm/";
+}
+
diff -U3 -r glademm-old/src/glade--.cc glademm/src/glade--.cc
--- glademm-old/src/glade--.cc	Sat Nov 16 17:37:19 2002
+++ glademm/src/glade--.cc	Sun Nov 17 14:58:31 2002
@@ -133,22 +133,20 @@
 {  CheckVersion("pkg-config --version",Configuration.pc_version,Pkg_Version::Pkg_Config);
 
    // Pkgconfig checks (Gnome 2)
-   if (Configuration.gnome2) {
-      if (!!Configuration.pc_version) {
-	 CheckVersion("pkg-config --silence-errors --modversion gtk+-2.0",Configuration.gtk_version,Pkg_Version::Pkg_Config);
-	 CheckVersion("pkg-config --silence-errors --modversion gtkmm-2.0",Configuration.gtkmm_version,Pkg_Version::Pkg_Config);
-	 CheckVersion("pkg-config --silence-errors --modversion gnomemm-2.0",Configuration.gnomemm_version,Pkg_Version::Pkg_Config);
-	 CheckVersion("pkg-config --silence-errors --modversion libgnomemm-2.0",Configuration.libgnomemm_version,Pkg_Version::Pkg_Config);
-	 CheckVersion("pkg-config --silence-errors --modversion libgnomeuimm-2.0",Configuration.libgnomeuimm_version,Pkg_Version::Pkg_Config);
-      }
-   }
-   else // old script checks
-   {  if (!Configuration.pc_version ||
-             !CheckVersion("pkg-config --silence-errors --modversion gtk+",Configuration.gtk_version,Pkg_Version::Pkg_Config))
-	 CheckVersion("gtk-config --version",Configuration.gtk_version,Pkg_Version::Gtk_Config);
-       CheckVersion("gtkmm-config --version",Configuration.gtkmm_version,Pkg_Version::Gtkmm_Config);
-       CheckVersion("gnome-config --modversion gnomemm",Configuration.gnomemm_version,Pkg_Version::Gnome_Config);
-   }
+   if (!!Configuration.pc_version) {
+      CheckVersion("pkg-config --silence-errors --modversion gtk+-2.0",Configuration.gtk2_version,Pkg_Version::Pkg_Config);
+      CheckVersion("pkg-config --silence-errors --modversion gtkmm-2.0",Configuration.gtkmm2_version,Pkg_Version::Pkg_Config);
+      CheckVersion("pkg-config --silence-errors --modversion libgnomemm-2.0",Configuration.libgnomemm_version,Pkg_Version::Pkg_Config);
+      CheckVersion("pkg-config --silence-errors --modversion libgnomeuimm-2.0",Configuration.libgnomeuimm_version,Pkg_Version::Pkg_Config);
+      CheckVersion("pkg-config --silence-errors --modversion libbonobomm-2.0",Configuration.libbonobomm_version,Pkg_Version::Pkg_Config);
+      CheckVersion("pkg-config --silence-errors --modversion libbonobouimm-2.0",Configuration.libbonobouimm_version,Pkg_Version::Pkg_Config);
+   }
+   // old script checks
+   if (!Configuration.pc_version ||
+       !CheckVersion("pkg-config --silence-errors --modversion gtk+",Configuration.gtk_version,Pkg_Version::Pkg_Config))
+      CheckVersion("gtk-config --version",Configuration.gtk_version,Pkg_Version::Gtk_Config);
+   CheckVersion("gtkmm-config --version",Configuration.gtkmm_version,Pkg_Version::Gtkmm_Config);
+   CheckVersion("gnome-config --modversion gnomemm",Configuration.gnomemm_version,Pkg_Version::Gnome_Config);
 }
 
 static void ApplyProject(const Tag &t)
@@ -314,6 +312,16 @@
    append_cs_args(PREFIX "/share/glademm-callbacks");
 }
 
+static void report_package_version(const char *name, Pkg_Version const &ver)
+{  if (!!ver)
+   {  std::cout << ", ";
+      if (!Configuration.gnome_support) std::cout << '[';
+      std::cout << name << ' ' << ver
+		<< " (" << ver.getSource()
+		<< ')';
+      if (!Configuration.gnome_support) std::cout << ']';
+   }
+}
 int main(int argc,char **argv)
 {  int opt;
    
@@ -447,6 +455,8 @@
    if (top.Type()=="glade-interface")
    {  Configuration.glade2=true;
       Configuration.gnome2=true;
+      Configuration.gtkmm_version=Configuration.gtkmm2_version;
+      Configuration.gtk_version=Configuration.gtk2_version;
       TagStream ts2(Configuration.in_filename+'p');
       try
       {  const Tag &t=ts2.getContent();
@@ -488,13 +498,14 @@
    	<< " (" << Configuration.gtk_version.getSource()
    	<< "), gtkmm " << Configuration.gtkmm_version 
    	<< " (" << Configuration.gtkmm_version.getSource() << ')';
-   if (!!Configuration.gnomemm_version)
-   {  std::cout << ", ";
-      if (!Configuration.gnome_support) std::cout << '[';
-      std::cout << "gnomemm " << Configuration.gnomemm_version 
-   	<< " (" << Configuration.gtk_version.getSource()
-   	<< ')';
-      if (!Configuration.gnome_support) std::cout << ']';
+   if (GNOME2) {
+      report_package_version("libgnomemm", Configuration.libgnomemm_version);
+      report_package_version("libgnomeuimm", Configuration.libgnomeuimm_version);
+      report_package_version("libbonobomm", Configuration.libbonobomm_version);
+      report_package_version("libbonobouimm", Configuration.libbonobouimm_version);
+   }
+   else {
+      report_package_version("gnomemm", Configuration.gnomemm_version);
    }
    std::cout << '\n';
    if (Configuration.gettext_support && !Configuration.gnome_support
diff -U3 -r glademm-old/src/writers/WriterBase.hh glademm/src/writers/WriterBase.hh
--- glademm-old/src/writers/WriterBase.hh	Sat Nov 16 17:37:19 2002
+++ glademm/src/writers/WriterBase.hh	Sun Nov 17 13:34:04 2002
@@ -161,25 +161,34 @@
 	   return "Gtk_";
 	}
 	static const std::string GnomePrefix()
-	{  if (Configuration.libgnomemm_version>=Pkg_Version(1,3,0))
+	{  if (GNOME2)
 	      return "Gnome::";
 	   // FIXME: Surely we should test gnomemm, not gtkmm, here.
 	   // When did Gnome:: become Gnome::UI?
 	   if (Configuration.gtkmm_version>=Pkg_Version(1,1,5))
 	      return "Gnome::";
-	   return "Gnome::";
+	   return "Gnome_";
 	}
 	static const std::string GnomeUIPrefix()
 	{  
-	   if (Configuration.libgnomeuimm_version>=Pkg_Version(1,3,0))
+	   if (GNOME2)
 	      return "Gnome::UI::";
 	   if (Configuration.gtkmm_version>=Pkg_Version(1,1,5))
 	      return "Gnome::";
 	   return "Gnome_";
 	}
 	static const std::string BonoboPrefix()
-	{   return "Bonobo::";
+	{
+	   if (GNOME2)
+	      return "Gnome::Bonobo::";
+	   return "Bonobo::";
 	}
+	static const std::string BonoboUIPrefix()
+	{
+	   if (GNOME2)
+	      return "Gnome::Bonobo::";
+	   return "Bonobo::";
+  	}
 	
 	// strange things ... do we really need these any longer ?
 	static const std::string instance(const Widget &w)
diff -U3 -r glademm-old/src/writers/bonobo_dock.cc glademm/src/writers/bonobo_dock.cc
--- glademm-old/src/writers/bonobo_dock.cc	Mon May 27 15:23:12 2002
+++ glademm/src/writers/bonobo_dock.cc	Sun Nov 17 15:10:08 2002
@@ -37,11 +37,13 @@
 static Bonobo_Dock Bonobo_Dock;
 
 const std::string Bonobo_Dock::TypeName(const Widget &w) const
-{  return BonoboPrefix()+"Dock";
+{  return BonoboUIPrefix()+"Dock";
 }
 
 const std::string Bonobo_Dock::IncludeName(const Widget &w) const
-{  return "bonobo/bonobo-dock.h";
+{  if (Configuration.libbonobomm_version >= Pkg_Version(1,3,0))
+      return Configuration.BonobommIncludePath()+"widgets/dock.h";
+   return "bonobo/bonobo-dock.h";
 }
 
 Bonobo_Dock::Bonobo_Dock()
@@ -65,6 +67,12 @@
    }
    else
    {  std::string placement(w.getProperty("placement","BONOBO_DOCK_TOP"));
+      int pos;
+      if (GNOME2) {
+	while ((pos = placement.find("BONOBO_DOCK_")) != std::string::npos) {
+	  placement.replace(pos, strlen("BONOBO_DOCK_"), "Gnome::Bonobo::DOCK_");
+	}
+      }
       // TODO: Why are we hard-coding to DOCK_TOP??
       // std::string _placement(w.getProperty("placement"));
       int band(w.getIntProperty("band",0));
diff -U3 -r glademm-old/src/writers/bonobo_dockitem.cc glademm/src/writers/bonobo_dockitem.cc
--- glademm-old/src/writers/bonobo_dockitem.cc	Sat Jun 15 14:22:14 2002
+++ glademm/src/writers/bonobo_dockitem.cc	Sun Nov 17 13:34:04 2002
@@ -34,11 +34,13 @@
 static Bonobo_DockItem Bonobo_DockItem;
 
 const std::string Bonobo_DockItem::TypeName(const Widget &w) const
-{  return BonoboPrefix()+"DockItem";
+{  return BonoboUIPrefix()+"DockItem";
 }
 
 const std::string Bonobo_DockItem::IncludeName(const Widget &w) const
-{  return "bonobo/bonobo-dock-item.h";
+{  if (Configuration.libbonobouimm_version >= Pkg_Version(1,3,0))
+      return Configuration.BonoboUImmIncludePath()+"widgets/dockitem.h";
+   return "bonobo/bonobo-dock-item.h";
 }
 
 Bonobo_DockItem::Bonobo_DockItem()
@@ -57,7 +59,20 @@
    if (options.size()>1) // strip leading '0|'
       options=std::string(options.begin()+2,options.end());
    // cast it (strange that this is necessary ...
-   options="BonoboDockItemBehavior("+options+")";
+   size_t pos;
+   if (GNOME2) {
+     // Convert to Gnome 2;
+     while ((pos = options.find("BONOBO_DOCK_ITEM_BEH_")) != std::string::npos) {
+       options.replace(pos, strlen("BONOBO_DOCK_ITEM_BEH_"),
+		       "Gnome::Bonobo::DOCK_ITEM_BEH_");
+     }
+     if (options == "0") {
+       options = "Gnome::Bonobo::DOCK_ITEM_BEH_NORMAL";
+     }
+   }
+   else {
+     options="BonoboDockItemBehavior("+options+")";
+   }
    
    f << Configuration.CString_WithQuotes(name);
    f.FunctionArg(options);
diff -U3 -r glademm-old/src/writers/gnome_app.cc glademm/src/writers/gnome_app.cc
--- glademm-old/src/writers/gnome_app.cc	Sat Nov 16 17:37:19 2002
+++ glademm/src/writers/gnome_app.cc	Sun Nov 17 13:34:04 2002
@@ -54,13 +54,25 @@
    Widget::const_iterator i=w.begin();
    for (Widget::const_iterator i=w.begin();i!=w.end();++i)
    {  Widget ch(*i);
-      if (ch.ChildName()=="GnomeApp:dock")
-         ; // ignore
-      else if (ch.ChildName()=="GnomeApp:appbar")
-         f.Statement() << instance << "set_statusbar(" << Reference(ch) << ")";
-      else
-         std::cerr << "Gnome App: strange child " << ch.Name() << '/' 
-         	<< ch.ChildName() << '\n';
+      if (GNOME2) {
+	 // FIXME: Required actions may be different for GNOME2
+	 if (ch.ChildName()=="dock")
+	    ; // ignore
+	 else if (ch.ChildName()=="appbar")
+	    f.Statement() << instance << "set_statusbar(" << Reference(ch) << ")";
+	 else
+	    std::cerr << "Gnome App: strange child " << ch.Name() << '/' 
+		      << ch.ChildName() << '\n';
+      }
+      else {
+	 if (ch.ChildName()=="GnomeApp:dock")
+	    ; // ignore
+	 else if (ch.ChildName()=="GnomeApp:appbar")
+	    f.Statement() << instance << "set_statusbar(" << Reference(ch) << ")";
+	 else
+	    std::cerr << "Gnome App: strange child " << ch.Name() << '/' 
+		      << ch.ChildName() << '\n';
+      }
    }
 }
 
@@ -76,15 +88,26 @@
 // ??? enable_layout_config(gboolean enable)
 
 Subwidget Gnome_App::IsSubwidget(const Widget &w,const Widget &ch) const
-{  if (ch.ChildName()=="GnomeApp:dock") return is_Subwidget_only;
-   if (ch.ChildName()=="GnomeApp:appbar") return not_Subwidget;
+{  if (GNOME2) {
+      if (ch.ChildName()=="dock") return is_Subwidget_only;
+      if (ch.ChildName()=="appbar") return not_Subwidget;
+   }
+   else {
+      if (ch.ChildName()=="GnomeApp:dock") return is_Subwidget_only;
+      if (ch.ChildName()=="GnomeApp:appbar") return not_Subwidget;
+   }
    if (!ch.ChildName().empty()) {  std::cerr << "Child name '" << ch.ChildName() << "'\n"; }
    return not_Subwidget;
 }
 
 const std::string Gnome_App::InternalInstance(const Widget &parent,const Widget &w2) const
 {  const std::string chn(w2.ChildName());
-   if (chn=="GnomeApp:dock") return "get_dock()->";
+   if (GNOME2) {
+      if (chn=="dock") return "get_dock()->";
+   }
+   else {
+      if (chn=="GnomeApp:dock") return "get_dock()->";
+   }
    return Parent::InternalInstance(parent,w2);
 }
                    
diff -U3 -r glademm-old/src/writers/gnome_appbar.cc glademm/src/writers/gnome_appbar.cc
--- glademm-old/src/writers/gnome_appbar.cc	Sat Nov 16 17:37:20 2002
+++ glademm/src/writers/gnome_appbar.cc	Sun Nov 17 13:34:04 2002
@@ -34,10 +34,21 @@
 
 static Gnome_AppBar Gnome_AppBar;
 
+static std::string map_preferences(const std::string &pt)
+{  if (GNOME2) {
+      if (pt == "GNOME_PREFERENCES_USER")
+	 return "Gnome::UI::PREFERENCES_USER";
+      if (pt == "GNOME_PREFERENCES_ALWAYS")
+	 return "Gnome::UI::PREFERENCES_ALWAYS";
+      return "Gnome::UI::PREFERENCES_NEVER";
+   }
+   return pt;
+}
+
 void Gnome_AppBar::ConstructionArgs(Widget const &w, CxxFile &f) const
 {  bool has_progress(w.getBoolProperty("has_progress"));
    bool has_status(w.getBoolProperty("has_status"));
-   std::string interactivity(w.getProperty("interactivity","GNOME_PREFERENCES_NEVER"));
+   std::string interactivity(map_preferences(w.getProperty("interactivity","GNOME_PREFERENCES_NEVER")));
 #warning is interactivity the correct name?   
    f.FunctionArg() << PRINT_BOOL(has_progress) << ", " 
    	<< PRINT_BOOL(has_status) << ", " << interactivity;
diff -U3 -r glademm-old/src/writers/menubar.cc glademm/src/writers/menubar.cc
--- glademm-old/src/writers/menubar.cc	Sat Nov 16 17:37:21 2002
+++ glademm/src/writers/menubar.cc	Sun Nov 17 13:34:04 2002
@@ -312,6 +312,9 @@
       	    f << "GNOMEUIINFO_SEPARATOR, ";
          else standard_item(w2,f,(cl=="GtkMenuItem"?"GNOME_APP_UI_ITEM":"GNOME_APP_UI_TOGGLEITEM"));
       }
+      else if (cl=="GtkSeparatorMenuItem")
+      {  f << "GNOMEUIINFO_SEPARATOR, ";
+      }
       else std::cerr << "MenuBar::recursively_build_menu: strange sub-widget type "
       	<< cl << '\n';
       	


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