mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-26 16:32:30 +01:00
- Slovak .po file updates from (Jan Tomka <judas@linux.sk>)
- "Save Workspace state" confirmation switch on the exit dialog panels (based on a patch from Jan Tomka <judas@linux.sk>)
This commit is contained in:
58
src/dialog.c
58
src/dialog.c
@@ -107,6 +107,64 @@ wMessageDialog(WScreen *scr, char *title, char *message,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
toggleSaveSession(WMWidget *w, void *data)
|
||||
{
|
||||
wPreferences.save_session_on_exit = WMGetButtonSelected((WMButton *) w);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
wExitDialog(WScreen *scr, char *title, char *message,
|
||||
char *defBtn, char *altBtn, char *othBtn)
|
||||
{
|
||||
WMAlertPanel *panel;
|
||||
WMButton *saveSessionBtn;
|
||||
Window parent;
|
||||
WWindow *wwin;
|
||||
int result;
|
||||
|
||||
panel = WMCreateAlertPanel(scr->wmscreen, NULL, title, message,
|
||||
defBtn, altBtn, othBtn);
|
||||
|
||||
/* add save session button */
|
||||
saveSessionBtn = WMCreateSwitchButton(panel->hbox);
|
||||
WMSetButtonAction(saveSessionBtn, toggleSaveSession, NULL);
|
||||
WMAddBoxSubview(panel->hbox, WMWidgetView(saveSessionBtn),
|
||||
False, True, 200, 0, 0);
|
||||
WMSetButtonText(saveSessionBtn, _("Save workspace state"));
|
||||
WMSetButtonSelected(saveSessionBtn, wPreferences.save_session_on_exit);
|
||||
WMRealizeWidget(saveSessionBtn);
|
||||
WMMapWidget(saveSessionBtn);
|
||||
|
||||
parent = XCreateSimpleWindow(dpy, scr->root_win, 0, 0, 400, 180, 0, 0, 0);
|
||||
|
||||
XReparentWindow(dpy, WMWidgetXID(panel->win), parent, 0, 0);
|
||||
|
||||
wwin = wManageInternalWindow(scr, parent, None, NULL,
|
||||
(scr->scr_width - 400)/2,
|
||||
(scr->scr_height - 180)/2, 400, 180);
|
||||
wwin->client_leader = WMWidgetXID(panel->win);
|
||||
|
||||
WMMapWidget(panel->win);
|
||||
|
||||
wWindowMap(wwin);
|
||||
|
||||
WMRunModalLoop(WMWidgetScreen(panel->win), WMWidgetView(panel->win));
|
||||
|
||||
result = panel->result;
|
||||
|
||||
WMUnmapWidget(panel->win);
|
||||
|
||||
wUnmanageWindow(wwin, False, False);
|
||||
|
||||
WMDestroyAlertPanel(panel);
|
||||
|
||||
XDestroyWindow(dpy, parent);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
wInputDialog(WScreen *scr, char *title, char *message, char **text)
|
||||
|
||||
@@ -174,21 +174,44 @@ static void
|
||||
exitCommand(WMenu *menu, WMenuEntry *entry)
|
||||
{
|
||||
static int inside = 0;
|
||||
int result;
|
||||
|
||||
/* prevent reentrant calls */
|
||||
if (inside)
|
||||
return;
|
||||
inside = 1;
|
||||
|
||||
if ((long)entry->clientdata==M_QUICK
|
||||
|| wMessageDialog(menu->frame->screen_ptr, _("Exit"),
|
||||
_("Exit window manager?"),
|
||||
_("Exit"), _("Cancel"), NULL)==WAPRDefault) {
|
||||
#define R_CANCEL 0
|
||||
#define R_EXIT 1
|
||||
|
||||
result = R_CANCEL;
|
||||
|
||||
if ((long)entry->clientdata==M_QUICK) {
|
||||
result = R_EXIT;
|
||||
} else {
|
||||
int r, oldSaveSessionFlag;
|
||||
|
||||
oldSaveSessionFlag = wPreferences.save_session_on_exit;
|
||||
r = wExitDialog(menu->frame->screen_ptr, _("Exit"),
|
||||
_("Exit window manager?"),
|
||||
_("Exit"), _("Cancel"), NULL);
|
||||
|
||||
if (r==WAPRDefault) {
|
||||
result = R_EXIT;
|
||||
} else if (r==WAPRAlternate) {
|
||||
/* Don't modify the "save session on exit" flag if the
|
||||
* user canceled the operation. */
|
||||
wPreferences.save_session_on_exit = oldSaveSessionFlag;
|
||||
}
|
||||
}
|
||||
if (result==R_EXIT) {
|
||||
#ifdef DEBUG
|
||||
printf("Exiting WindowMaker.\n");
|
||||
#endif
|
||||
Shutdown(WSExitMode);
|
||||
}
|
||||
#undef R_EXIT
|
||||
#undef R_CANCEL
|
||||
inside = 0;
|
||||
}
|
||||
|
||||
@@ -229,15 +252,22 @@ shutdownCommand(WMenu *menu, WMenuEntry *entry)
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
int r;
|
||||
int r, oldSaveSessionFlag;
|
||||
|
||||
r = wMessageDialog(menu->frame->screen_ptr,
|
||||
_("Kill X session"),
|
||||
_("Kill Window System session?\n"
|
||||
"(all applications will be closed)"),
|
||||
_("Kill"), _("Cancel"), NULL);
|
||||
if (r==WAPRDefault)
|
||||
result = R_KILL;
|
||||
oldSaveSessionFlag = wPreferences.save_session_on_exit;
|
||||
|
||||
r = wExitDialog(menu->frame->screen_ptr,
|
||||
_("Kill X session"),
|
||||
_("Kill Window System session?\n"
|
||||
"(all applications will be closed)"),
|
||||
_("Kill"), _("Cancel"), NULL);
|
||||
if (r==WAPRDefault) {
|
||||
result = R_KILL;
|
||||
} else if (r==WAPRAlternate) {
|
||||
/* Don't modify the "save session on exit" flag if the
|
||||
* user canceled the operation. */
|
||||
wPreferences.save_session_on_exit = oldSaveSessionFlag;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1198,9 +1198,9 @@ createInspectorForWindow(WWindow *wwin, int xpos, int ypos,
|
||||
#endif
|
||||
|
||||
spec_text = _("The configuration will apply to all\n"
|
||||
"windows that have their WM_CLASS\n"
|
||||
"property set to the above selected\n"
|
||||
"name, when saved.");
|
||||
"windows that have their WM_CLASS\n"
|
||||
"property set to the above selected\n"
|
||||
"name, when saved.");
|
||||
|
||||
panel = wmalloc(sizeof(InspectorPanel));
|
||||
memset(panel, 0, sizeof(InspectorPanel));
|
||||
|
||||
Reference in New Issue
Block a user