[glade--]Patch for glademm-2.0.0.1

"Howdy Pierce" <[email protected]> Wed, 25 Feb 2004 13:23:21 -0700
Newsgroups gmane.comp.gnome.glademm
Message-ID <[email protected]>
Hello glade-- folks--

Attached is a patch to glade-- 2.0.0.1.  It fixes one bug
and adds a little new functionality.  Changes:

1. Finds the pixmap directory correctly when source dir is
either "" (the empty string) or "."  (This had been a bug
against 1.1.3d, which was fixed, but it seems to have
regressed, so now it's fixed again.)

2. Properly handles the "CAN_DEFAULT" property, writing out
a call to
     widget->set_flags(CAN_DEFAULT);

3. Properly handles the "HAS_DEFAULT" property, writing out
a call to
     widget->grab_default()
(this is only done for the FIRST widget in a window that has
HAS_DEFAULT,
and it gets written out after the signal handlers are
written.)

I can't confess to fully understanding the glade-- internal
data structure, so please convince yourself that my changes
are correct.  In particular, the changes to Cxx_Fileset.cc
need to be reviewed.

Thanks,
--Howdy

  =============================
  Howdy Pierce
  Managing Partner
  Cardinal Peak, LLC

  email: [email protected]
  work: (303) 665-3962
  cell: (303) 589-1645
  =============================
glademm.patch (application/octet-stream, 2.3 KB)
--- glademm-2.0.0.1/src/Cxx_Fileset.cc	2003-06-18 04:35:48.000000000 -0600
+++ glademm-2.0.0.1-mod/src/Cxx_Fileset.cc	2004-02-24 16:26:12.000000000 -0700
@@ -353,7 +353,22 @@
       }
    }
    ConnectSignalHandler(top_wr,w,w,inst);
+	 // Write out grab_default(), if any
+   for (Widget::const_contained_iterator i=w.begin_contained(Internal_Both);
+	i!=w.end_contained();++i)
+   {  Widget w2(*i);
+	 if (w2.getBoolProperty("has_default") )
+      {  const Widget WriterWidget(*(i.getWriterTag()));
+         const WriterBase &ww_wr(LookupWriter(WriterWidget));
+         std::string instance(ww_wr.Instance(WriterWidget,w2,i.getSWType()));
+         if (instance.empty()) 
+         {  continue; // can't connect this widget
+         }
+				 gc.Statement() << instance << "grab_default()";
+				 break;
+			 }
+	 }
 
    // add them to the map
    if (Configuration.lookup_table)
--- glademm-2.0.0.1/src/glade--.cc	2003-05-17 12:22:09.000000000 -0600
+++ glademm-2.0.0.1-mod/src/glade--.cc	2004-02-24 14:54:51.000000000 -0700
@@ -230,8 +230,10 @@
    // XXX make pixmaps directory relative to source
    if ((Configuration.pixmap_dir.empty() || Configuration.pixmap_dir[0]!='/'))
       // blind guess, but better than nothing
-   {  if (!Configuration.source_directory.empty() && Configuration.source_directory!=".")
+		 {  if (!Configuration.source_directory.empty() && 
+						Configuration.source_directory!="/" &&
+						Configuration.source_directory!="/.")						
          Configuration.pixmap_dir_relative_to_src="../"+Configuration.pixmap_dir;
       else // src should be current (?)
          Configuration.pixmap_dir_relative_to_src=Configuration.pixmap_dir;
--- glademm-2.0.0.1/src/writers/widget.cc	2003-06-16 08:08:17.000000000 -0600
+++ glademm-2.0.0.1-mod/src/writers/widget.cc	2004-02-24 16:14:17.000000000 -0700
@@ -115,8 +115,12 @@
 
    if (GTKMM1) WriteBoolProp_2Fun(w,f,instance, "can_focus", 
    		"unset_flags(GTK_CAN_FOCUS)", "set_flags(GTK_CAN_FOCUS)");
-   else WriteBoolProp_2Fun(w,f,instance, "can_focus", 
+   else {
+		 WriteBoolProp_2Fun(w,f,instance, "can_focus", 
    		"unset_flags(Gtk::CAN_FOCUS)", "set_flags(Gtk::CAN_FOCUS)"); 
+		 WriteBoolProp_2Fun(w,f,instance, "can_default", 
+   		"unset_flags(Gtk::CAN_DEFAULT)", "set_flags(Gtk::CAN_DEFAULT)"); 
+	 }
 
    if (w.getBoolProperty("has_focus",false))
    {  f.Statement() << instance << "grab_focus()";