[Glade-users] Does glade work with GTK+ 2.4?

Damon Chaplin damon@karuna.uklinux.net
31 Mar 2004 12:13:54 +0100


--=-Sn+pD8sVldKIR2qwRdPE
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

On Wed, 2004-03-31 at 10:22, Gary Herron wrote:
> I just upgraded my GTK to version 2.4, and now glade is exhibiting the
> following problem.
> 
> When I build a GUI which contains a toolbar, any toolbar buttons of
> type Button or Toggle Button or Radio Button, disappear.  They show up
> in the widget tree, but do not show up on the screen, and do not show
> up in the XML file when saved.
> 
> Also, a previously built (before my upgrade), and fully working, GUI
> which contains such toolbar buttons can not be safely read in and
> written back out.  If I do so, all the buttons in the toolbar are
> lost. (That is the XML description of the toolbar contains no <child>
> tags.)
> 
> Before my upgrade to GTK 2.4, the version of glade I was using (How
> can I tell wwhich version I had?) worked fine with toolbars.  After my
> upgrade to 2.4, the problem occurs with whatever version of glade I
> was previously running, as well as newly built versions glade-2.0.1
> and glade-2.5.0.

The GTK+ toolbar changed internally in GTK+ 2.4, so glade 2.0.1 will not
work with it.

Glade 2.5.0 should work OK with normal/radio/toggle buttons, but there
is a bug which means any other widgets are lost. I'm about to do a new
release which fixes that.

I've attached the relevant patch if you want tot try it.

Damon


--=-Sn+pD8sVldKIR2qwRdPE
Content-Disposition: attachment; filename=glade.patch
Content-Type: text/plain; name=glade.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- glade-2.5.0/glade/gbwidgets/gbtoolbar.c	2004-03-17 17:14:09.000000000 +0000
+++ glade-2.5.1/glade/gbwidgets/gbtoolbar.c	2004-03-28 17:15:06.000000000 +0100
@@ -159,11 +159,25 @@
       gtk_toolbar_insert (GTK_TOOLBAR (widget),
 			  GTK_TOOL_ITEM (toolitem), -1);
     }
-  else
+  /* GtkToolItems can just be added as they are. */
+  else if (GTK_IS_TOOL_ITEM (child))
     {
       gtk_toolbar_insert (GTK_TOOLBAR (widget),
 			  GTK_TOOL_ITEM (child), -1);
     }
+  /* Any other widgets are from the old GTK+ 2.2 files, and we need to insert
+     a GtkToolItem. */
+  else
+    {
+      GtkWidget *toolitem = gb_widget_new_full ("GtkToolItem", FALSE,
+						NULL, NULL, 0, 0, NULL,
+						GB_LOADING, data);
+      gtk_toolbar_insert (GTK_TOOLBAR (widget),
+			  GTK_TOOL_ITEM (toolitem), -1);
+      tree_add_widget (toolitem);
+
+      gtk_container_add (GTK_CONTAINER (toolitem), child);
+    }
 }
 
 

--=-Sn+pD8sVldKIR2qwRdPE--