1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-02-18 15:35:55 +01:00

WPrefs: Display warning when attempting to modify a read-only menu file.

This commit is contained in:
Doug Torrance
2017-08-19 10:48:42 -04:00
committed by Carlos R. Mafra
parent b68a1994c2
commit 97702618de

View File

@@ -1484,6 +1484,7 @@ static void showData(_Panel * panel)
{ {
const char *gspath; const char *gspath;
char *menuPath; char *menuPath;
char buf[1024];
WMPropList *pmenu; WMPropList *pmenu;
gspath = wusergnusteppath(); gspath = wusergnusteppath();
@@ -1510,6 +1511,21 @@ static void showData(_Panel * panel)
if (!path) if (!path)
break; break;
if (access(path, W_OK) < 0) {
snprintf(buf, 1024,
_("The menu file \"%s\" referenced by "
"WMRootMenu is read-only.\n"
"You cannot use WPrefs to modify it."),
path);
WMRunAlertPanel(WMWidgetScreen(panel->parent),
panel->parent,
_("Warning"), buf,
_("OK"), NULL, NULL);
panel->dontSave = True;
wfree(path);
return;
}
pmenu = WMReadPropListFromFile(path); pmenu = WMReadPropListFromFile(path);
wfree(path); wfree(path);
} }