1 /* NoMenuAlert.c - warn user that menu can't be edited with WPrefs
3 * WPrefs - Window Maker Preferences Program
5 * Copyright (c) 1999 Alfredo K. Kojima
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
27 typedef struct NoMenuPanel
{
40 #define MESSAGE_TEXT \
41 " The menu that is being used now could not be opened. "\
42 "This either means that there is a syntax error in it or that "\
43 "the menu is in a format not supported by WPrefs (WPrefs only "\
44 "supports property list menus).\n"\
45 " If you want to keep using the current menu, please read "\
46 "the '%s/%s' file, press 'Keep Current Menu' and edit it with a "\
48 " If you want to use this editor, press 'Copy Default Menu'. "\
49 "It will copy the default menu and will instruct Window Maker "\
50 "to use it instead of the current one.\n"\
51 " If you want more flexibility, keep using the current one "\
52 "as it allows you to use C preprocessor (cpp) macros, while being "\
53 "easy to edit. Window Maker supports both formats."
57 closeCallback(WMWidget
*self
, void *data
)
59 NoMenuPanel
*panel
= (NoMenuPanel
*)data
;
61 panel
->finished
= True
;
66 buttonCallback(WMWidget
*self
, void *data
)
68 NoMenuPanel
*panel
= (NoMenuPanel
*)data
;
70 panel
->finished
= True
;
71 if (self
== panel
->keepBtn
)
79 AskMenuCopy(WMWindow
*wwin
)
84 panel
.wwin
= WMCreatePanelForWindow(wwin
, "noMenuAlert");
85 WMResizeWidget(panel
.wwin
, 430, 260);
86 WMSetWindowTitle(panel
.wwin
, "Warning");
87 WMSetWindowCloseAction(panel
.wwin
, closeCallback
, &panel
);
89 panel
.text
= WMCreateLabel(panel
.wwin
);
90 WMResizeWidget(panel
.text
, 370, 200);
91 WMMoveWidget(panel
.text
, 30, 20);
93 sprintf(buffer
, _(MESSAGE_TEXT
), wusergnusteppath(),
94 "Library/WindowMaker/README");
95 WMSetLabelText(panel
.text
, buffer
);
97 panel
.copyBtn
= WMCreateCommandButton(panel
.wwin
);
98 WMResizeWidget(panel
.copyBtn
, 180, 24);
99 WMMoveWidget(panel
.copyBtn
, 30, 225);
100 WMSetButtonText(panel
.copyBtn
, _("Copy Default Menu"));
101 WMSetButtonAction(panel
.copyBtn
, buttonCallback
, &panel
);
103 panel
.keepBtn
= WMCreateCommandButton(panel
.wwin
);
104 WMResizeWidget(panel
.keepBtn
, 180, 24);
105 WMMoveWidget(panel
.keepBtn
, 225, 225);
106 WMSetButtonText(panel
.keepBtn
, _("Keep Current Menu"));
107 WMSetButtonAction(panel
.keepBtn
, buttonCallback
, &panel
);
109 WMMapSubwidgets(panel
.wwin
);
110 WMRealizeWidget(panel
.wwin
);
111 WMMapWidget(panel
.wwin
);
113 panel
.finished
= False
;
116 while (!panel
.finished
) {
119 WMNextEvent(WMScreenDisplay(WMWidgetScreen(panel
.wwin
)), &event
);
120 WMHandleEvent(&event
);
123 WMDestroyWidget(panel
.wwin
);