On Fri, 17 Sep 2010, Tamas TEVESZ wrote:

 > can you check whether substituting this for a possibly tweaked of the 
 > following still works as desired, while giving suitable visual 
 > feedback as to what exactly has been cleared?

last breath before falling asleep.

i meant the following, but it's not perfect. it correctly notifies 
about which item is deemed to be bad, but (after having the warning 
dismissed) clicking on "save" causes wprefs to segfault. i suspect 
this is because the corresponding proplist node isn't actually 
cleared, and it causes trouble later on. pulling this part off is 
probably going to be a bit tricky.

diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c
index dccb85b..997cfb9 100644
--- a/WPrefs.app/Menu.c
+++ b/WPrefs.app/Menu.c
@@ -509,7 +509,7 @@ static void createPanel(_Panel * p)
                data->param.exec.command = "eterm";
 
                data = putNewItem(panel, pad, ExecInfo, _("Run..."));
-               data->param.exec.command = _("%a(Run,Type command to run)");
+               data->param.exec.command = _("%A(Run,Type command to run)");
 
                data = putNewItem(panel, pad, ExecInfo, _("Netscape"));
                data->param.exec.command = "netscape";
@@ -1030,7 +1030,8 @@ static ItemData *parseCommand(WMPropList * item)
                        cmd = 11;
                } else {
                        wwarning(_("unknown command '%s' in menu"), command);
-                       goto error;
+                       wfree(data);
+                       return NULL;
                }
 
                data->type = CommandInfo;
@@ -1043,11 +1044,6 @@ static ItemData *parseCommand(WMPropList * item)
        }
 
        return data;
-
- error:
-       wfree(data);
-
-       return NULL;
 }
 
 static void updateFrameTitle(_Panel * panel, char *title, InfoType type)
@@ -1400,9 +1396,18 @@ static WEditMenu *buildSubmenu(_Panel * panel, 
WMPropList * pl)
 
                        data = parseCommand(pi);
 
-                       if (panel->markerPix[data->type])
-                               WSetEditMenuItemImage(item, 
panel->markerPix[data->type]);
-                       WSetEditMenuItemData(item, data, (WMCallback *) 
freeItemData);
+                       if(data != NULL) {
+                               if (panel->markerPix[data->type])
+                                       WSetEditMenuItemImage(item, 
panel->markerPix[data->type]);
+                               WSetEditMenuItemData(item, data, (WMCallback *) 
freeItemData);
+                       } else {
+                               char *buf = wmalloc(1024);
+                               snprintf(buf, 1024, _("Invalid meny entry 
\"%s\" labeled \"%s\" cleared"),
+                                       WMGetFromPLString(WMGetFromPLArray(pi, 
1)),
+                                       WMGetFromPLString(WMGetFromPLArray(pi, 
0)));
+                               WMRunAlertPanel(scr, panel->parent, 
_("Warning"), buf, _("OK"), NULL, NULL);
+                               wfree(buf);
+                       }
                }
        }
 

-- 
[-]

mkdir /nonexistent


-- 
To unsubscribe, send mail to [email protected].

Reply via email to