Previously, WPrefs could only be used to edit the menu specified in WMRootMenu.
In a recent commit, the ability to specify a menu in proplist format defined in another file which is referenced by WMRootMenu was added. However, if a user attempted to edit such a menu in WPrefs, an error dialog appeared. We add the ability for WPrefs to read such a menu. After the user makes any changes, the result is stored in WMRootMenu, and *not* the original file. --- WPrefs.app/Menu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c index feadd5fb..a18e495e 100644 --- a/WPrefs.app/Menu.c +++ b/WPrefs.app/Menu.c @@ -22,6 +22,7 @@ #include "WPrefs.h" #include <assert.h> #include <ctype.h> +#include <unistd.h> #include <X11/keysym.h> #include <X11/cursorfont.h> @@ -1493,6 +1494,26 @@ static void showData(_Panel * panel) pmenu = WMReadPropListFromFile(menuPath); + /* check if WMRootMenu references another file, and if so, + if that file is in proplist format */ + while (WMIsPLString(pmenu)) { + char *path = NULL; + + path = wexpandpath(WMGetFromPLString(pmenu)); + + if (access(path, F_OK) < 0) + path = wfindfile(DEF_CONFIG_PATHS, path); + + /* TODO: if needed, concatenate locale suffix to path. + See getLocalizedMenuFile() in src/rootmenu.c. */ + + if (!path) + break; + + pmenu = WMReadPropListFromFile(path); + wfree(path); + } + if (!pmenu || !WMIsPLArray(pmenu)) { int res; -- 2.11.0 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.