Re: [PATCH 2/7] WPrefs: Edit proplist menus referenced by WMRootMenu.

"Carlos R. Mafra" <[email protected]> Sat, 19 Aug 2017 11:13:20 +0100
Newsgroups gmane.compw.window-managers.windowmaker.devel
Message-ID <[email protected]>
Thanks Doug.

I have one comment:

On Fri, 18 Aug 2017 at 20:37:46 -0400, Doug Torrance wrote:
> 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.

That's nice!

> After the user makes any changes, the result is stored in WMRootMenu,
> and *not* the original file.

This is unexpected and will probably defeat the purpose of
having a separate file for the menu in the first place.

What is the technical challenge to save the changes back
into the original file? That would be much better.




> ---
>  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 [email protected].


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