From 6ae01b9d9045a4f8489ecd0dc4ee3bd847b6e736 Mon Sep 17 00:00:00 2001 From: "Rodolfo Garc??a Pe??as (kix)" Date: Thu, 12 Jan 2012 19:07:05 +0100 Subject: [PATCH] WPrefs: Fetch default menu from system path If you delete the file ~GNUStep/Defaults/WMRootMenu and run WMPrefs and go to the Menu Edit tab, it will show a dialog about keeping the menu or discarding it. If you discard it then WPrefs shows an error: "Could not open default menu from '/home/user/GNUStep/Library/WindowMaker/plmenu" The problem is at WPrefs.app/Menu.c:1424, and it happens because it tries to load the default menu from the user's GNUstep home, but plmenu is not copied there during the installation. Of course, the file doesn't need to be copied to the users home, so WPrefs should try to read it from /usr/share/WindowMaker/plmenu (Debian) or /usr/local/share/WindowMaker/plmenu (upstream). --- WPrefs.app/Makefile.am | 2 +- WPrefs.app/Menu.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/WPrefs.app/Makefile.am b/WPrefs.app/Makefile.am index 654457f5..3f664282 100644 --- a/WPrefs.app/Makefile.am +++ b/WPrefs.app/Makefile.am @@ -40,7 +40,7 @@ WPrefs_SOURCES = \ editmenu.h \ xmodifier.c -AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\" -DRESOURCE_PATH=\"$(wpdatadir)\" +AM_CPPFLAGS = -DLOCALEDIR=\"$(NLSDIR)\" -DRESOURCE_PATH=\"$(wpdatadir)\" -DWMAKER_RESOURCE_PATH=\"$(pkgdatadir)\" AM_CFLAGS = INCLUDES = -I$(top_srcdir)/wrlib -I$(top_srcdir)/WINGs @HEADER_SEARCH_PATH@ diff --git a/WPrefs.app/Menu.c b/WPrefs.app/Menu.c index 66b24d1c..21a9fe13 100644 --- a/WPrefs.app/Menu.c +++ b/WPrefs.app/Menu.c @@ -41,6 +41,7 @@ typedef enum { } InfoType; #define MAX_SECTION_SIZE 4 +#define PATH_LEN 256 typedef struct _Panel { WMBox *box; @@ -1426,10 +1427,10 @@ static WMPropList *getDefaultMenu(_Panel * panel) WMPropList *menu; char *menuPath, *gspath; - gspath = wusergnusteppath(); + gspath = wstrdup(WMAKER_RESOURCE_PATH); menuPath = wmalloc(strlen(gspath) + 128); - sprintf(menuPath, "%s/Library/WindowMaker/plmenu", gspath); + sprintf(menuPath, "%s/plmenu", gspath); menu = WMReadPropListFromFile(menuPath); @@ -1444,6 +1445,7 @@ static WMPropList *getDefaultMenu(_Panel * panel) wfree(buffer); } + wfree(gspath); wfree(menuPath); return menu; -- 2.11.4.GIT