* Now we have a hardcoded list of apps which shall not be terminated on

shutdown (input, app, debug server, and registrar).
* Fixed crashing bug, if the shutdown was aborted before the window was
  created.
* The text of the confirmation alert depends on whether we reboot or
  shut down.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13643 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2005-07-12 12:36:08 +00:00
parent c458888ae0
commit 29aa57037d
3 changed files with 29 additions and 32 deletions

View File

@ -621,10 +621,8 @@ ShutdownProcess::ShutdownProcess(TRoster *roster, EventQueue *eventQueue)
ShutdownProcess::~ShutdownProcess()
{
// terminate the GUI
if (fHasGUI) {
fWindow->Lock();
if (fHasGUI && fWindow && fWindow->Lock())
fWindow->Quit();
}
// remove and delete the quit request reply handler
if (fQuitRequestReplyHandler) {
@ -1109,7 +1107,7 @@ status_t
ShutdownProcess::_ShutDown()
{
#ifdef __HAIKU__
return _kern_shutdown(fReboot);
RETURN_ERROR(_kern_shutdown(fReboot));
#else
// we can't do anything on R5
return B_ERROR;
@ -1225,9 +1223,13 @@ ShutdownProcess::_WorkerDoShutdown()
// ask the user to confirm the shutdown, if desired
bool askUser;
if (fHasGUI && fRequest->FindBool("confirm", &askUser) == B_OK && askUser) {
BAlert *alert = new BAlert("Shut Down?",
"Do you really want to shut down the system?",
"Shut Down", "Cancel", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
const char *title = (fReboot ? "Reboot?" : "Shut Down?");
const char *text = (fReboot
? "Do you really want to reboot the system?"
: "Do you really want to shut down the system?");
const char *buttonText = (fReboot ? "Reboot" : "Shut Down");
BAlert *alert = new BAlert(title, text, buttonText, "Cancel", NULL,
B_WIDTH_AS_USUAL, B_WARNING_ALERT);
int32 result = alert->Go();
if (result != 0)
@ -1266,6 +1268,7 @@ ShutdownProcess::_WorkerDoShutdown()
// we're through: do the shutdown
_SetPhase(DONE_PHASE);
_SetShutdownWindowWaitForShutdown();
_ShutDown();
PRINT((" _kern_shutdown() failed\n"));
@ -1273,8 +1276,6 @@ ShutdownProcess::_WorkerDoShutdown()
// shutdown failed: This can happen for power off mode -- reboot should
// always work.
if (fHasGUI) {
_SetShutdownWindowWaitForShutdown();
// wait for the reboot event
uint32 event;
do {

View File

@ -1294,28 +1294,40 @@ TRoster::GetShutdownApps(AppInfoList &userApps, AppInfoList &systemApps,
status_t error = B_OK;
// add ourself to the vital system apps and try to find the app server
// get the vital system apps:
// * ourself
// * app server
// * input server
// * debug server
if (error == B_OK) {
// ourself
vitalSystemApps.insert(be_app->Team());
// the app server
// app server
port_id appServerPort = find_port(SERVER_PORT_NAME);
port_info portInfo;
if (appServerPort >= 0
&& get_port_info(appServerPort, &portInfo) == B_OK) {
vitalSystemApps.insert(portInfo.team);
}
// input server
RosterAppInfo *info
= fRegisteredApps.InfoFor("application/x-vnd.Be-input_server");
if (info)
vitalSystemApps.insert(info->team);
// debug server
info = fRegisteredApps.InfoFor("application/x-vnd.haiku-debug-server");
if (info)
vitalSystemApps.insert(info->team);
}
// populate the other groups
for (AppInfoList::Iterator it(fRegisteredApps.It());
RosterAppInfo *info = *it;
++it) {
if (vitalSystemApps.find(info->team) != vitalSystemApps.end()) {
// must be us or the app server
} else if (_IsVitalSystemApp(info)) {
vitalSystemApps.insert(info->team);
} else {
if (vitalSystemApps.find(info->team) == vitalSystemApps.end()) {
RosterAppInfo *clonedInfo = info->Clone();
if (clonedInfo) {
if (info->flags & B_BACKGROUND_APP) {
@ -1644,21 +1656,6 @@ TRoster::_HandleGetRecentEntries(BMessage *request)
FUNCTION_END();
}
// _IsVitalSystemApp
bool
TRoster::_IsVitalSystemApp(RosterAppInfo *info) const
{
BPath path;
status_t error = path.SetTo(&info->ref);
if (error != B_OK)
return false;
int len = strlen(path.Path());
int prefixLen = strlen(kVitalSystemAppPathPrefix);
return (len > prefixLen
&& strncmp(path.Path(), kVitalSystemAppPathPrefix, prefixLen) == 0);
}
// _IsSystemApp
bool
TRoster::_IsSystemApp(RosterAppInfo *info) const

View File

@ -113,7 +113,6 @@ private:
void _HandleGetRecentEntries(BMessage *request);
bool _IsVitalSystemApp(RosterAppInfo *info) const;
bool _IsSystemApp(RosterAppInfo *info) const;
status_t _LoadRosterSettings(const char *path = NULL);