[glade--]Todays patches...

Björn Axelsson <[email protected]>
Newsgroups gmane.comp.gnome.glademm
Message-ID <[email protected]>
Those patches are a bit more questionable than my last, so someone with a
better grip of the big picture will have to verify them. (But they work
for me =)

writers/image.cc:
  - Don't try to embed image if it is a stock image.

writers/menuitem.cc:
  - Enabled use of accelerators.

  What is the deal with the accelerators anyway? Why wont glade-- generate
  them as default and why does it print the warning about broken code
  compability when I manually enable accelerators

writers/scrolledwindow.cc:
  - Enabled edge shadow type.
  This was (almost) there already, but commented away. Why?

-- 
Björn Axelsson
diffs.txt (text/plain, 6.5 KB)
? diffs.txt
? writers/.image.cc.swp
? writers/.image.cvs.cc.swp
? writers/diffs.txt
? writers/image.cvs.cc
Index: writers/image.cc
===================================================================
RCS file: /cvs/gnome/glade--/src/writers/image.cc,v
retrieving revision 1.26
diff -u -r1.26 image.cc
--- writers/image.cc	10 Dec 2002 11:30:32 -0000	1.26
+++ writers/image.cc	11 Dec 2002 15:02:24 -0000
@@ -57,19 +57,21 @@
 
 void Gtk_Image::GCInclude(const Widget &w,CxxFile &f) const
 {  Parent::GCInclude(w,f);
-   if (GTKMM1) f.Include(Configuration.GtkmmIncludePath()+"imageloader.h");
-   const std::string pixbuf=w.getProperty("pixbuf");
-   if (Configuration.embed_images)
-   {  if (!xpmname(pixbuf).empty())
+   if (w.getProperty("stock").empty())     
+   {  if (GTKMM1) f.Include(Configuration.GtkmmIncludePath()+"imageloader.h");
+      const std::string pixbuf=w.getProperty("pixbuf");
+      if (Configuration.embed_images)
+      {  if (!xpmname(pixbuf).empty())
          f.Include(Configuration.CString(Configuration.pixmap_dir_relative_to_src+"/"+pixbuf),true);
-      else if (GTKMM2)
-      {  f.Include("gdkmm/pixbufloader.h");
-         if (!f.ElementAlreadyThere(CxxFile::element_t(v_Image,pixbuf)))
-         {  EmbedImage(f,pixbuf);
-            f.AddElement(CxxFile::element_t(v_Image,pixbuf));
+         else if (GTKMM2)
+         {  f.Include("gdkmm/pixbufloader.h");
+            if (!f.ElementAlreadyThere(CxxFile::element_t(v_Image,pixbuf)))
+            {  EmbedImage(f,pixbuf);
+               f.AddElement(CxxFile::element_t(v_Image,pixbuf));
+            }
          }
-      }
-   }      
+      }      
+   }
 }
 
 // Glib::RefPtr<Pixmap> (Glib::RefPtr<Colormap>&,Glib::RefPtr<Bitmap>& mask,data)
@@ -122,30 +124,32 @@
    std::string xpm_ident=xpmname(pixbuf);
    std::string instname=Configuration.InstanceName(w.Name());
    if (GTKMM2)
-   { if (Configuration.embed_images)
-     {if (!xpm_ident.empty())
-      {  f.Declaration() << "Glib::RefPtr<Gdk::Bitmap> _"
-   		<< instname <<"_mask";
-         f.Declaration() << "Glib::RefPtr<Gdk::Pixmap> _"
-      		<< instname <<"_pixmap "
-      		"= Gdk::Pixmap::create_from_xpm(get_default_colormap(), _"
-		<< instname <<"_mask, "
-		<< xpm_ident << ')';
-      }
-      else
-      {  f.Declaration() << "Glib::RefPtr<Gdk::PixbufLoader> _" << instname
-      		<< "_loader=Gdk::PixbufLoader::create()";
-         if (Configuration.gtkmm_version<Pkg_Version(2,0,0))
-      	    f.Declaration() << "GError *_" << instname << "_err=0";
-      	 f.Statement() << "_" << instname << "_loader->write(" 
-      	 	<< Configuration.CName(pixbuf) << "_data, sizeof " 
-      	 	<< Configuration.CName(pixbuf) << "_data";
-      	 if (Configuration.gtkmm_version<Pkg_Version(2,0,0))
-      	    f << ", _" << instname << "_err";
-      	 f << ')';
-      	 f.Statement() << "_" << instname << "_loader->close()";
+   {  if (w.getProperty("stock").empty())      
+      { if (Configuration.embed_images)
+         {if (!xpm_ident.empty())
+            {  f.Declaration() << "Glib::RefPtr<Gdk::Bitmap> _"
+               << instname <<"_mask";
+               f.Declaration() << "Glib::RefPtr<Gdk::Pixmap> _"
+                  << instname <<"_pixmap "
+                  "= Gdk::Pixmap::create_from_xpm(get_default_colormap(), _"
+                  << instname <<"_mask, "
+                  << xpm_ident << ')';
+            }
+            else
+            {  f.Declaration() << "Glib::RefPtr<Gdk::PixbufLoader> _" << instname
+               << "_loader=Gdk::PixbufLoader::create()";
+               if (Configuration.gtkmm_version<Pkg_Version(2,0,0))
+                  f.Declaration() << "GError *_" << instname << "_err=0";
+               f.Statement() << "_" << instname << "_loader->write(" 
+                  << Configuration.CName(pixbuf) << "_data, sizeof " 
+                  << Configuration.CName(pixbuf) << "_data";
+               if (Configuration.gtkmm_version<Pkg_Version(2,0,0))
+                  f << ", _" << instname << "_err";
+               f << ')';
+               f.Statement() << "_" << instname << "_loader->close()";
+            }
+         }
       }
-     }
       Parent::CreatePointer(w,f);
    }
    else // can not work with 1.2 ???
Index: writers/menuitem.cc
===================================================================
RCS file: /cvs/gnome/glade--/src/writers/menuitem.cc,v
retrieving revision 1.35
diff -u -r1.35 menuitem.cc
--- writers/menuitem.cc	17 Jun 2002 07:03:25 -0000	1.35
+++ writers/menuitem.cc	11 Dec 2002 15:02:24 -0000
@@ -88,7 +88,7 @@
       /* Convert accelerator spec to parseable string. May actually have
 	 passed something like mods|key directly instead, but this allows
 	 accelerators to be localized. */
-      if (Configuration.has_accelerators && w.hasProperty("accelerator")) 
+      if (Configuration.has_accelerators) 
       { for (Widget::const_iterator i=w.get_Accels();i!=w.end();++i) {
 	 std::string mods=i->getGladeAttr("modifiers");
 	std::string key=i->getGladeAttr("key");
@@ -124,8 +124,8 @@
        }
        else // GTKMM2
        {  replace_all(mods,"GDK_","Gdk::");
-          f.FunctionArg() << "Gtk::Menu_Helpers::AccelKey(" << mods 
-          	<< ", " << key << ")";
+          f.FunctionArg() << "Gtk::Menu_Helpers::AccelKey(" 
+          	<< "'" << key << "', " << mods << ")"; 
        }
       }
       }
Index: writers/scrolledwindow.cc
===================================================================
RCS file: /cvs/gnome/glade--/src/writers/scrolledwindow.cc,v
retrieving revision 1.24
diff -u -r1.24 scrolledwindow.cc
--- writers/scrolledwindow.cc	15 Jun 2002 13:22:14 -0000	1.24
+++ writers/scrolledwindow.cc	11 Dec 2002 15:02:24 -0000
@@ -49,9 +49,8 @@
 
 void Gtk_ScrolledWindow::Configure(const Widget &w, CxxFile &f,const std::string &instance) const
 {  Parent::Configure(w,f,instance);
-//   std::string shadow_type(w.getProperty("shadow_type","GTK_SHADOW_NONE"));
-//   and what to do with this?
-//   f.Statement() << instance << "set_shadow_type(" << shadow_type << ')';
+   std::string shadow_type(w.getProperty("shadow_type","GTK_SHADOW_NONE"));
+   f.Statement() << instance << "set_shadow_type(" << Gtkmm2Namespace(shadow_type) << ')';
    if (w.hasProperty("hscrollbar_policy") || w.hasProperty("vscrollbar_policy"))
    {  std::string hscrollbar_policy(w.getProperty("hscrollbar_policy","GTK_POLICY_AUTOMATIC"));
       std::string vscrollbar_policy(w.getProperty("vscrollbar_policy","GTK_POLICY_AUTOMATIC"));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.