notification_server: Converted to BServer, launch on demand.

This commit is contained in:
Axel Dörfler
2015-10-14 22:24:19 +02:00
parent 8f27961801
commit b5e496b575
4 changed files with 32 additions and 19 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ service x-vnd.Haiku-print_server {
service x-vnd.Haiku-notification_server { service x-vnd.Haiku-notification_server {
launch /system/servers/notification_server launch /system/servers/notification_server
no_safemode no_safemode
legacy on_demand
} }
service x-vnd.Haiku-power_daemon { service x-vnd.Haiku-power_daemon {
+1 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src servers notification ; SubDir HAIKU_TOP src servers notification ;
UsePrivateHeaders notification ; UsePrivateHeaders app notification ;
Server notification_server : Server notification_server :
AppGroupView.cpp AppGroupView.cpp
@@ -1,11 +1,12 @@
/* /*
* Copyright 2010, Haiku, Inc. All Rights Reserved. * Copyright 2010-2015, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
* Pier Luigi Fiorini, [email protected] * Pier Luigi Fiorini, [email protected]
*/ */
#include <Beep.h> #include <Beep.h>
#include <Notifications.h> #include <Notifications.h>
#include <PropertyInfo.h> #include <PropertyInfo.h>
@@ -13,6 +14,7 @@
#include "NotificationWindow.h" #include "NotificationWindow.h"
#include "NotificationServer.h" #include "NotificationServer.h"
const char* kSoundNames[] = { const char* kSoundNames[] = {
"Information notification", "Information notification",
"Important notification", "Important notification",
@@ -22,8 +24,9 @@ const char* kSoundNames[] = {
}; };
NotificationServer::NotificationServer() NotificationServer::NotificationServer(status_t& error)
: BApplication(kNotificationServerSignature) :
BServer(kNotificationServerSignature, true, &error)
{ {
} }
@@ -96,6 +99,9 @@ NotificationServer::ResolveSpecifier(BMessage* msg, int32 index,
} }
// #pragma mark -
int int
main(int argc, char* argv[]) main(int argc, char* argv[])
{ {
@@ -106,8 +112,10 @@ main(int argc, char* argv[])
add_system_beep_event(kSoundNames[i++], 0); add_system_beep_event(kSoundNames[i++], 0);
// Start! // Start!
NotificationServer server; status_t error;
server.Run(); NotificationServer server(error);
if (error == B_OK)
server.Run();
return 0; return error == B_OK ? EXIT_SUCCESS : EXIT_FAILURE;
} }
+16 -11
View File
@@ -1,28 +1,33 @@
/* /*
* Copyright 2010, Haiku, Inc. All Rights Reserved. * Copyright 2010-2015, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifndef _NOTIFICATION_SERVER_H #ifndef _NOTIFICATION_SERVER_H
#define _NOTIFICATION_SERVER_H #define _NOTIFICATION_SERVER_H
#include <Application.h>
#include <Server.h>
class NotificationWindow; class NotificationWindow;
class NotificationServer : public BApplication {
class NotificationServer : public BServer {
public: public:
NotificationServer(); NotificationServer(status_t& error);
virtual ~NotificationServer(); virtual ~NotificationServer();
virtual void ReadyToRun(); virtual void ReadyToRun();
virtual void MessageReceived(BMessage* message); virtual void MessageReceived(BMessage* message);
virtual status_t GetSupportedSuites(BMessage* msg); virtual status_t GetSupportedSuites(BMessage* msg);
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec, virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
int32 form, const char* prop); BMessage* spec, int32 form,
const char* prop);
private: private:
NotificationWindow* fWindow; NotificationWindow* fWindow;
}; };
#endif // _NOTIFICATION_SERVER_H #endif // _NOTIFICATION_SERVER_H