1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 04:20:27 +01:00

WPrefs: Edit proplist menus referenced by WMRootMenu.

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.
This commit is contained in:
Doug Torrance
2017-08-18 20:37:46 -04:00
committed by Carlos R. Mafra
parent 6f195b18fc
commit 02cc702029

View File

@@ -22,6 +22,7 @@
#include "WPrefs.h" #include "WPrefs.h"
#include <assert.h> #include <assert.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
@@ -1493,6 +1494,26 @@ static void showData(_Panel * panel)
pmenu = WMReadPropListFromFile(menuPath); 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)) { if (!pmenu || !WMIsPLArray(pmenu)) {
int res; int res;