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

gEDA-user: gschem-patch: Fix warning on mouse-over menu-item without action



 Hello,

I found a small bug on moving over a menu-item in gschem which has submenu-items. This is, e.g., the recent-file-menu. The log-window gives some warnings because this menu-items have no action defined. The appended patch fixes this.

It would be nice, if one ore more of you can test this patch and give some feedback! Thank you :-)

Felix
From 71b8a5a3e8e2831065291bd1f6f629cb78b67f18 Mon Sep 17 00:00:00 2001
From: Felix Ruoff <Felix@xxxxxxxxxxxxxxxxxx>
Date: Sat, 9 Oct 2010 18:35:33 +0200
Subject: [PATCH] Fix warning on moving over menu-item without action

Fix a warning at the info-dialog if the mouse moves over a menu-item which has no action definet, e.g. the top item of a submenu.
---
 gschem/src/x_menus.c |   30 ++++++++++++++----------------
 1 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/gschem/src/x_menus.c b/gschem/src/x_menus.c
index 6ea77ed..5a7e9ba 100644
--- a/gschem/src/x_menus.c
+++ b/gschem/src/x_menus.c
@@ -105,7 +105,6 @@ get_main_menu(GSCHEM_TOPLEVEL *w_current)
   char **raw_menu_name = g_malloc (sizeof(char *));
   char *menu_item_name;
   char *raw_menu_item_name;
-  char *menu_item_func;
   char *menu_item_hotkey_func;
   char *menu_item_stock;
   char *menu_item_keys;
@@ -149,11 +148,6 @@ get_main_menu(GSCHEM_TOPLEVEL *w_current)
 
       raw_menu_item_name = SCM_STRING_CHARS (scm_item_name);
 
-      if (scm_is_false (scm_item_func))
-        menu_item_func = "no-action";
-      else
-        menu_item_func = SCM_SYMBOL_CHARS (scm_item_func);
-
       if (scm_is_false (scm_item_hotkey_func))
         menu_item_hotkey_func = NULL;
       else
@@ -187,17 +181,21 @@ get_main_menu(GSCHEM_TOPLEVEL *w_current)
           menu_item_keys = "";
         }
 
-        action = gschem_action_new (menu_item_func,  /* Action name */
-                                    menu_item_name,  /* Text */
-                                    menu_item_name,  /* Tooltip */
-                                    menu_item_stock, /* Icon stock ID */
-                                    menu_item_keys); /* Accelerator string */
-        menu_item = gtk_action_create_menu_item (GTK_ACTION (action));
-        gtk_menu_append (GTK_MENU (menu), menu_item);
+        if(scm_is_false (scm_item_func)) {
+          menu_item = gtk_menu_item_new_with_mnemonic(menu_item_name); 
+        } else {
+          action = gschem_action_new (SCM_SYMBOL_CHARS (scm_item_func),  /* Action name */
+                                      menu_item_name,  /* Text */
+                                      menu_item_name,  /* Tooltip */
+                                      menu_item_stock, /* Icon stock ID */
+                                      menu_item_keys); /* Accelerator string */
+          menu_item = gtk_action_create_menu_item (GTK_ACTION (action));
+          g_signal_connect (G_OBJECT(action), "activate",
+                            G_CALLBACK(g_menu_execute),
+                            w_current);
+        }
 
-        g_signal_connect (G_OBJECT(action), "activate",
-                          G_CALLBACK(g_menu_execute),
-                          w_current);
+        gtk_menu_append (GTK_MENU (menu), menu_item);
       }
 
       gtk_widget_show (menu_item);
-- 
1.7.1


_______________________________________________
geda-user mailing list
geda-user@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-user