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 {
launch /system/servers/notification_server
no_safemode
legacy
on_demand
}
service x-vnd.Haiku-power_daemon {
+1 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src servers notification ;
UsePrivateHeaders notification ;
UsePrivateHeaders app notification ;
Server notification_server :
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.
*
* Authors:
* Pier Luigi Fiorini, [email protected]
*/
#include <Beep.h>
#include <Notifications.h>
#include <PropertyInfo.h>
@@ -13,6 +14,7 @@
#include "NotificationWindow.h"
#include "NotificationServer.h"
const char* kSoundNames[] = {
"Information notification",
"Important notification",
@@ -22,8 +24,9 @@ const char* kSoundNames[] = {
};
NotificationServer::NotificationServer()
: BApplication(kNotificationServerSignature)
NotificationServer::NotificationServer(status_t& error)
:
BServer(kNotificationServerSignature, true, &error)
{
}
@@ -96,6 +99,9 @@ NotificationServer::ResolveSpecifier(BMessage* msg, int32 index,
}
// #pragma mark -
int
main(int argc, char* argv[])
{
@@ -106,8 +112,10 @@ main(int argc, char* argv[])
add_system_beep_event(kSoundNames[i++], 0);
// Start!
NotificationServer server;
status_t error;
NotificationServer server(error);
if (error == B_OK)
server.Run();
return 0;
return error == B_OK ? EXIT_SUCCESS : EXIT_FAILURE;
}
+11 -6
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.
*/
#ifndef _NOTIFICATION_SERVER_H
#define _NOTIFICATION_SERVER_H
#include <Application.h>
#include <Server.h>
class NotificationWindow;
class NotificationServer : public BApplication {
class NotificationServer : public BServer {
public:
NotificationServer();
NotificationServer(status_t& error);
virtual ~NotificationServer();
virtual void ReadyToRun();
virtual void MessageReceived(BMessage* message);
virtual status_t GetSupportedSuites(BMessage* msg);
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, BMessage* spec,
int32 form, const char* prop);
virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index,
BMessage* spec, int32 form,
const char* prop);
private:
NotificationWindow* fWindow;
};
#endif // _NOTIFICATION_SERVER_H