Ticket #3733: patch_deskbar

File patch_deskbar, 2.1 KB (added by stpere, 16 years ago)
Line 
1Index: src/apps/deskbar/BeMenu.cpp
2===================================================================
3--- src/apps/deskbar/BeMenu.cpp (révision 30390)
4+++ src/apps/deskbar/BeMenu.cpp (copie de travail)
5@@ -367,8 +367,8 @@
6 AddSeparatorItem();
7
8 #ifdef __HAIKU__
9- item = new BMenuItem("Restart" B_UTF8_ELLIPSIS,
10- new BMessage(CMD_REBOOT_SYSTEM));
11+ item = new BMenuItem("End session" B_UTF8_ELLIPSIS,
12+ new BMessage(CMD_SHUTDOWN_SYSTEM));
13 #else
14 item = new BMenuItem("Restart", new BMessage(CMD_REBOOT_SYSTEM));
15 #endif
16@@ -376,21 +376,20 @@
17 AddItem(item);
18
19 #ifdef APM_SUPPORT
20+#ifndef __HAIKU__
21 if (_kapm_control_(APM_CHECK_ENABLED) == B_OK) {
22 item = new BMenuItem("Suspend", new BMessage(CMD_SUSPEND_SYSTEM));
23 item->SetEnabled(!dragging);
24 AddItem(item);
25 }
26 #endif
27+#endif
28
29-#ifdef __HAIKU__
30- item = new BMenuItem("Shut Down" B_UTF8_ELLIPSIS,
31- new BMessage(CMD_SHUTDOWN_SYSTEM));
32-#else
33+#ifndef __HAIKU__
34 item = new BMenuItem("Shut Down", new BMessage(CMD_SHUTDOWN_SYSTEM));
35-#endif
36 item->SetEnabled(!dragging);
37 AddItem(item);
38+#endif
39
40 fAddState = kAddingRecents;
41
42Index: src/apps/deskbar/BarApp.cpp
43===================================================================
44--- src/apps/deskbar/BarApp.cpp (révision 30390)
45+++ src/apps/deskbar/BarApp.cpp (copie de travail)
46@@ -48,6 +48,7 @@
47 #include <Roster.h>
48
49 #if __HAIKU__
50+# include <Alert.h>
51 # include <RosterPrivate.h>
52 #endif
53
54@@ -489,10 +490,17 @@
55
56 case CMD_REBOOT_SYSTEM:
57 case CMD_SHUTDOWN_SYSTEM: {
58- bool reboot = (message->what == CMD_REBOOT_SYSTEM);
59+ BAlert *alert = new BAlert("shutdown", "Would you like to restart or rather shutdown your system?",
60+ "Cancel", "Restart", "Shut down",
61+ B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
62+ alert->SetShortcut(0, B_ESCAPE);
63+ int32 answer = alert->Go();
64+ if (answer == 0)
65+ break;
66+ bool reboot = (answer == 1);
67 BRoster roster;
68 BRoster::Private rosterPrivate(roster);
69- status_t error = rosterPrivate.ShutDown(reboot, true, false);
70+ status_t error = rosterPrivate.ShutDown(reboot, false, false);
71 if (error != B_OK)
72 fprintf(stderr, "Shutdown failed: %s\n", strerror(error));
73