The Deskbar can now shutdown or reboot Haiku, but we should have a way to shutdown asynchronously, see TODO
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13712 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -47,6 +47,10 @@ All rights reserved.
|
|||||||
#include <Path.h>
|
#include <Path.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
|
|
||||||
|
#if __HAIKU__
|
||||||
|
# include <RosterPrivate.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "FavoritesConfig.h"
|
#include "FavoritesConfig.h"
|
||||||
|
|
||||||
#include "icons.h"
|
#include "icons.h"
|
||||||
@@ -457,6 +461,26 @@ TBarApp::MessageReceived(BMessage *message)
|
|||||||
fSwitcherMess.SendMessage(message);
|
fSwitcherMess.SendMessage(message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#if __HAIKU__
|
||||||
|
case CMD_REBOOT_SYSTEM:
|
||||||
|
case CMD_SUSPEND_SYSTEM:
|
||||||
|
case CMD_SHUTDOWN_SYSTEM: {
|
||||||
|
// TODO: Deskbar cannot quit because BRoster::Private::Shutdown() is synchronous,
|
||||||
|
// so we launch a thread which does the shutdown, this should be reworked so
|
||||||
|
// that we can simply send a message to the roster and be done with it
|
||||||
|
void* cookie = message->what == CMD_SHUTDOWN_SYSTEM ? NULL : (void*)1;
|
||||||
|
thread_id thread = spawn_thread(_shutdown, "shutdown thread", B_NORMAL_PRIORITY, cookie);
|
||||||
|
if (thread >= B_OK) {
|
||||||
|
status_t ret = resume_thread(thread);
|
||||||
|
if (ret < B_OK)
|
||||||
|
fprintf(stderr, "error resuming shutdown thread: %s\n", strerror(ret));
|
||||||
|
} else
|
||||||
|
fprintf(stderr, "error spawning shutdown thread: %s\n", strerror(thread));
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif // __HAIKU__
|
||||||
|
|
||||||
default:
|
default:
|
||||||
BApplication::MessageReceived(message);
|
BApplication::MessageReceived(message);
|
||||||
break;
|
break;
|
||||||
@@ -643,6 +667,19 @@ TBarApp::ShowConfigWindow()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if __HAIKU__
|
||||||
|
// _shutdown
|
||||||
|
int32
|
||||||
|
TBarApp::_shutdown(void* cookie)
|
||||||
|
{
|
||||||
|
BRoster roster;
|
||||||
|
BRoster::Private rosterPrivate(roster);
|
||||||
|
status_t error = rosterPrivate.ShutDown(cookie != NULL, false);
|
||||||
|
fprintf(stderr, "Shutdown failed: %s\n", strerror(error));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif // __HAIKU__
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ All rights reserved.
|
|||||||
#define _FLOATER_W_TYPE_ 4
|
#define _FLOATER_W_TYPE_ 4
|
||||||
#define _STD_W_TYPE_ 0
|
#define _STD_W_TYPE_ 0
|
||||||
|
|
||||||
|
|
||||||
class BarTeamInfo {
|
class BarTeamInfo {
|
||||||
public:
|
public:
|
||||||
BarTeamInfo(BList *teams, uint32 flags, char *sig, BBitmap *icon,
|
BarTeamInfo(BList *teams, uint32 flags, char *sig, BBitmap *icon,
|
||||||
@@ -77,6 +76,11 @@ const uint32 msg_sortRunningApps = 'SAps';
|
|||||||
const uint32 msg_superExpando = 'SprE';
|
const uint32 msg_superExpando = 'SprE';
|
||||||
const uint32 msg_expandNewTeams = 'ExTm';
|
const uint32 msg_expandNewTeams = 'ExTm';
|
||||||
|
|
||||||
|
// from roster_private.h
|
||||||
|
const uint32 CMD_SHUTDOWN_SYSTEM = 301;
|
||||||
|
const uint32 CMD_REBOOT_SYSTEM = 302;
|
||||||
|
const uint32 CMD_SUSPEND_SYSTEM = 304;
|
||||||
|
|
||||||
/* --------------------------------------------- */
|
/* --------------------------------------------- */
|
||||||
|
|
||||||
// if you want to extend this structure, maintain the
|
// if you want to extend this structure, maintain the
|
||||||
@@ -154,6 +158,10 @@ private:
|
|||||||
|
|
||||||
void ShowConfigWindow();
|
void ShowConfigWindow();
|
||||||
|
|
||||||
|
#if __HAIKU__
|
||||||
|
static int32 _shutdown(void* cookie);
|
||||||
|
#endif
|
||||||
|
|
||||||
TBarWindow *fBarWindow;
|
TBarWindow *fBarWindow;
|
||||||
BMessenger fSwitcherMess;
|
BMessenger fSwitcherMess;
|
||||||
BMessenger fStatusViewMess;
|
BMessenger fStatusViewMess;
|
||||||
|
|||||||
@@ -48,11 +48,6 @@ All rights reserved.
|
|||||||
#include "StatusView.h"
|
#include "StatusView.h"
|
||||||
#include "IconMenuItem.h"
|
#include "IconMenuItem.h"
|
||||||
|
|
||||||
// from roster_private.h
|
|
||||||
const uint32 CMD_SHUTDOWN_SYSTEM = 301;
|
|
||||||
const uint32 CMD_REBOOT_SYSTEM = 302;
|
|
||||||
const uint32 CMD_SUSPEND_SYSTEM = 304;
|
|
||||||
|
|
||||||
#define ROSTER_SIG "application/x-vnd.Be-ROST"
|
#define ROSTER_SIG "application/x-vnd.Be-ROST"
|
||||||
|
|
||||||
#ifdef B_BEOS_VERSION_5
|
#ifdef B_BEOS_VERSION_5
|
||||||
@@ -455,7 +450,11 @@ TBeMenu::ResetTargets()
|
|||||||
case CMD_SUSPEND_SYSTEM:
|
case CMD_SUSPEND_SYSTEM:
|
||||||
case CMD_SHUTDOWN_SYSTEM:
|
case CMD_SHUTDOWN_SYSTEM:
|
||||||
// restart/shutdown
|
// restart/shutdown
|
||||||
|
#if __HAIKU__
|
||||||
|
item->SetTarget(be_app);
|
||||||
|
#else
|
||||||
item->SetTarget(BMessenger(ROSTER_SIG));
|
item->SetTarget(BMessenger(ROSTER_SIG));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
SubDir OBOS_TOP src apps deskbar ;
|
SubDir OBOS_TOP src apps deskbar ;
|
||||||
|
|
||||||
|
UsePrivateHeaders app ;
|
||||||
UsePrivateHeaders shared ;
|
UsePrivateHeaders shared ;
|
||||||
UsePrivateHeaders tracker ;
|
UsePrivateHeaders tracker ;
|
||||||
SubDirHdrs $(OBOS_TOP) src kits tracker ;
|
SubDirHdrs $(OBOS_TOP) src kits tracker ;
|
||||||
|
|||||||
Reference in New Issue
Block a user