SaveState is now called from the media_server

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@5554 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Jérôme Duval 2003-12-03 10:27:12 +00:00
parent e976b957c3
commit 96ee2f2de0
2 changed files with 11 additions and 7 deletions

View File

@ -27,7 +27,6 @@ MMediaFilesManager::~MMediaFilesManager()
{ {
CALLED(); CALLED();
delete fRunner; delete fRunner;
SaveState();
delete fRegistryMap; delete fRegistryMap;
delete fLocker; delete fLocker;
} }
@ -144,6 +143,7 @@ MMediaFilesManager::LoadState()
status_t status_t
MMediaFilesManager::SaveState() MMediaFilesManager::SaveState()
{ {
CALLED();
status_t err = B_OK; status_t err = B_OK;
BPath path; BPath path;
if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK) if((err = find_directory(B_USER_SETTINGS_DIRECTORY, &path))!=B_OK)
@ -181,7 +181,9 @@ MMediaFilesManager::SaveState()
file.Write(&zero, sizeof(uint32)); file.Write(&zero, sizeof(uint32));
} }
file.Write(&zero, sizeof(uint32)); file.Write(&zero, sizeof(uint32));
printf("save state ok\n");
return B_OK; return B_OK;
} }

View File

@ -107,7 +107,7 @@ private:
BLocker *fLocker; BLocker *fLocker;
void MessageReceived(BMessage *msg); virtual void MessageReceived(BMessage *msg);
typedef BApplication inherited; typedef BApplication inherited;
}; };
@ -171,6 +171,7 @@ bool
ServerApp::QuitRequested() ServerApp::QuitRequested()
{ {
TRACE("ServerApp::QuitRequested()\n"); TRACE("ServerApp::QuitRequested()\n");
gMMediaFilesManager->SaveState();
gNodeManager->SaveState(); gNodeManager->SaveState();
gAppManager->TerminateAddonServer(); gAppManager->TerminateAddonServer();
return true; return true;
@ -691,7 +692,8 @@ ServerApp::controlthread(void *arg)
return 0; return 0;
} }
void ServerApp::MessageReceived(BMessage *msg) void
ServerApp::MessageReceived(BMessage *msg)
{ {
TRACE("ServerApp::MessageReceived %lx enter\n", msg->what); TRACE("ServerApp::MessageReceived %lx enter\n", msg->what);
switch (msg->what) { switch (msg->what) {
@ -699,9 +701,9 @@ void ServerApp::MessageReceived(BMessage *msg)
case MEDIA_SERVER_CANCEL_NOTIFICATIONS: gNotificationManager->EnqueueMessage(msg); break; case MEDIA_SERVER_CANCEL_NOTIFICATIONS: gNotificationManager->EnqueueMessage(msg); break;
case MEDIA_SERVER_SEND_NOTIFICATIONS: gNotificationManager->EnqueueMessage(msg); break; case MEDIA_SERVER_SEND_NOTIFICATIONS: gNotificationManager->EnqueueMessage(msg); break;
case MMEDIAFILESMANAGER_SAVE_TIMER: gMMediaFilesManager->TimerMessage(); break; case MMEDIAFILESMANAGER_SAVE_TIMER: gMMediaFilesManager->TimerMessage(); break;
default: default: inherited::MessageReceived(msg); break;
printf("\nnew media server: unknown message received\n"); //printf("\nnew media server: unknown message received\n");
msg->PrintToStream(); //msg->PrintToStream();
} }
TRACE("ServerApp::MessageReceived %lx leave\n", msg->what); TRACE("ServerApp::MessageReceived %lx leave\n", msg->what);
} }