libegg tweaks



I'm currently porting Gnucash from the gtk/gnome 1.4 libraries to the
2.2 libraries.  We're using the menu merge stuff from libegg, and I had
to make a few tweaks to get it to work correctly.  The main problem was
with popup menus, but I was also getting extra callbacks to my action
functions.  I've attached the diffs from libegg cvs HEAD below.  I saw
in the archives (just joined this list yesterday) that the menu merge
code is being integrated into gtk+, but I couldn't find it there to
generate a set of diffs when I checked out gtk+ cvs.

David


Index: libegg/menu/egg-action.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/menu/egg-action.c,v
retrieving revision 1.17
diff -u -r1.17 egg-action.c
--- libegg/menu/egg-action.c	9 May 2003 15:15:27 -0000	1.17
+++ libegg/menu/egg-action.c	10 Aug 2003 21:45:35 -0000
@@ -572,7 +572,8 @@
 					G_CALLBACK (egg_action_sync_label),
 					proxy);
 
-  gtk_menu_item_set_accel_path (GTK_MENU_ITEM (proxy), NULL);
+  if (GTK_IS_MENU_ITEM (proxy))
+	gtk_menu_item_set_accel_path (GTK_MENU_ITEM (proxy), NULL);
 
   /* toolbar button specific synchronisers ... */
   g_signal_handlers_disconnect_by_func (action,
@@ -686,7 +687,7 @@
 
   if (prev_action)
     {
-      (* EGG_ACTION_GET_CLASS (action)->disconnect_proxy) (action, proxy);  
+      (* EGG_ACTION_GET_CLASS (action)->disconnect_proxy) (prev_action, proxy);  
     }
 
   (* EGG_ACTION_GET_CLASS (action)->connect_proxy) (action, proxy);
Index: libegg/menu/egg-menu-merge.c
===================================================================
RCS file: /cvs/gnome/libegg/libegg/menu/egg-menu-merge.c,v
retrieving revision 1.26
diff -u -r1.26 egg-menu-merge.c
--- libegg/menu/egg-menu-merge.c	20 Apr 2003 14:28:50 -0000	1.26
+++ libegg/menu/egg-menu-merge.c	10 Aug 2003 21:45:38 -0000
@@ -200,7 +200,7 @@
 		    NODE_INFO(child)->type = node_type;
 		  
 		  /* warn about type mismatch */
-		  if (NODE_INFO(child)->type != EGG_MENU_MERGE_UNDECIDED &&
+		  if (node_type != EGG_MENU_MERGE_UNDECIDED &&
 		      NODE_INFO(child)->type != node_type)
 		    g_warning("node type doesn't match %d (%s is type %d)",
 			      node_type, NODE_INFO(child)->name,
@@ -826,6 +826,10 @@
 	  pos = g_list_index(GTK_MENU_SHELL(menushell)->children,
 			     NODE_INFO(parent)->proxy) + 1;
 	  break;
+	case EGG_MENU_MERGE_POPUPS:
+	  menushell = NULL;
+	  pos = 0;
+	  break;
 	default:
 	  g_warning("%s: bad parent node type %d", G_STRLOC,
 		    NODE_INFO(parent)->type);
@@ -1030,8 +1034,9 @@
 		    menu = gtk_menu_new();
 		    gtk_menu_item_set_submenu(GTK_MENU_ITEM(info->proxy), menu);
 		    gtk_menu_set_accel_group (GTK_MENU (menu), self->accel_group);
-		    gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
-					   info->proxy, pos);
+		    if (menushell)
+		      gtk_menu_shell_insert (GTK_MENU_SHELL (menushell),
+					     info->proxy, pos);
 		  }
 	      }
 	    else

Attachment: signature.asc
Description: This is a digitally signed message part



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