Some changes to make it better fit into a Haiku distribution:
* Fixed Terminal signature to Haiku's Terminal. * Removed documentation menu item. * Minor cleanups. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17589 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
/*
|
||||
|
||||
PCWorld.cpp
|
||||
|
||||
ProcessController
|
||||
© 2000, Georges-Edouard Berenger, All Rights Reserved.
|
||||
|
||||
ProcessController © 2000, Georges-Edouard Berenger, All Rights Reserved.
|
||||
Copyright (C) 2004 beunited.org
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
@@ -19,91 +17,103 @@
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include "PCWorld.h"
|
||||
#include "PCWindow.h"
|
||||
#include "PCView.h"
|
||||
#include "PCUtils.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <Roster.h>
|
||||
#include <Deskbar.h>
|
||||
|
||||
const char *kSignature = "application/x-vnd.Geb-ProcessController";
|
||||
const char *kTrackerSig = "application/x-vnd.Be-TRAK";
|
||||
const char *kDeskbarSig = "application/x-vnd.Be-TSKB";
|
||||
const char *kTerminalSig = "application/x-vnd.Be-SHEL";
|
||||
const char* kPreferencesFileName = "ProcessController Prefs";
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
thread_id id = 0;
|
||||
const char* kSignature = "application/x-vnd.Geb-ProcessController";
|
||||
const char* kTrackerSig = "application/x-vnd.Be-TRAK";
|
||||
const char* kDeskbarSig = "application/x-vnd.Be-TSKB";
|
||||
const char* kTerminalSig = "application/x-vnd.Haiku-Terminal";
|
||||
const char* kPreferencesFileName = "ProcessController Prefs";
|
||||
|
||||
int main()
|
||||
{
|
||||
PCApplication application;
|
||||
application.Run();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
thread_id id = 0;
|
||||
|
||||
PCApplication::PCApplication():BApplication(kSignature)
|
||||
|
||||
PCApplication::PCApplication()
|
||||
: BApplication(kSignature)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PCApplication::~PCApplication()
|
||||
{
|
||||
status_t thread_return_value;
|
||||
if (id) {
|
||||
wait_for_thread(id, &thread_return_value);
|
||||
id = 0;
|
||||
status_t returnValue;
|
||||
wait_for_thread(id, &returnValue);
|
||||
}
|
||||
}
|
||||
|
||||
void PCApplication::ReadyToRun ()
|
||||
|
||||
void
|
||||
PCApplication::ReadyToRun()
|
||||
{
|
||||
new PCWindow();
|
||||
// quitter les autres ProcessController eventuels...
|
||||
BList list;
|
||||
be_roster->GetAppList (kSignature, &list);
|
||||
long pc_count = list.CountItems ();
|
||||
if (pc_count > 1) {
|
||||
for (long k = 0; k < pc_count-1; k++) {
|
||||
BMessenger* otherme = new BMessenger (NULL, (team_id) list.ItemAt (k));
|
||||
BMessage* message = new BMessage (B_QUIT_REQUESTED);
|
||||
otherme->SendMessage (message);
|
||||
|
||||
// quit other eventually running instances
|
||||
BList list;
|
||||
be_roster->GetAppList(kSignature, &list);
|
||||
long count = list.CountItems();
|
||||
if (count > 1) {
|
||||
for (long i = 0; i < count - 1; i++) {
|
||||
BMessenger* otherme = new BMessenger(NULL, (team_id)list.ItemAt(i));
|
||||
BMessage* message = new BMessage(B_QUIT_REQUESTED);
|
||||
otherme->SendMessage(message);
|
||||
delete otherme;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PCApplication::ArgvReceived (int32 argc, char **argv)
|
||||
|
||||
void
|
||||
PCApplication::ArgvReceived (int32 argc, char **argv)
|
||||
{
|
||||
if (argc == 2 && strcmp (argv[1], "-desktop-reset") == 0)
|
||||
{
|
||||
team_id tracker = be_roster->TeamFor (kTrackerSig);
|
||||
if (tracker >= 0)
|
||||
{
|
||||
BMessenger messenger (NULL, tracker);
|
||||
messenger.SendMessage (B_QUIT_REQUESTED);
|
||||
if (argc == 2 && strcmp(argv[1], "-desktop-reset") == 0) {
|
||||
team_id tracker = be_roster->TeamFor(kTrackerSig);
|
||||
if (tracker >= 0) {
|
||||
BMessenger messenger(NULL, tracker);
|
||||
messenger.SendMessage(B_QUIT_REQUESTED);
|
||||
int k = 500;
|
||||
do {
|
||||
snooze (10000);
|
||||
} while (be_roster->IsRunning (kTrackerSig) && k-- > 0);
|
||||
snooze(10000);
|
||||
} while (be_roster->IsRunning(kTrackerSig) && k-- > 0);
|
||||
}
|
||||
remove ("/boot/home/config/settings/Tracker/tracker_shelf");
|
||||
launch (kTrackerSig, "/boot/beos/system/Tracker");
|
||||
}
|
||||
else if (argc == 2 && strcmp (argv[1], "-deskbar") == 0)
|
||||
{
|
||||
BDeskbar db;
|
||||
if (!gInDeskbar && !db.HasItem (kDeskbarItemName))
|
||||
move_to_deskbar (db);
|
||||
}
|
||||
else if (argc > 1) {
|
||||
remove("/boot/home/config/settings/Tracker/tracker_shelf");
|
||||
launch(kTrackerSig, "/boot/beos/system/Tracker");
|
||||
} else if (argc == 2 && strcmp(argv[1], "-deskbar") == 0) {
|
||||
BDeskbar deskbar;
|
||||
if (!gInDeskbar && !deskbar.HasItem(kDeskbarItemName))
|
||||
move_to_deskbar(deskbar);
|
||||
} else if (argc > 1) {
|
||||
// print a simple usage string
|
||||
printf( "Usage: %s [-deskbar]\n", argv[0]);
|
||||
printf( "(c) 1997-2001 Georges-Edouard Berenger, [email protected]\n");
|
||||
}
|
||||
Quit ();
|
||||
|
||||
Quit();
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
PCApplication application;
|
||||
application.Run();
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user