* Removed the version check, and the Deskbar restart code.

* This closes ticket #2314.
* Minor cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33862 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2009-11-02 08:44:47 +00:00
parent fd0795f24c
commit dd9740dad4
+21 -40
View File
@@ -35,13 +35,14 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
class PCApplication : public BApplication {
public:
PCApplication();
virtual ~PCApplication();
virtual void ReadyToRun(); class PCApplication : public BApplication {
virtual void ArgvReceived(int32 argc, char **argv); public:
PCApplication();
virtual ~PCApplication();
virtual void ReadyToRun();
virtual void ArgvReceived(int32 argc, char** argv);
}; };
@@ -59,7 +60,8 @@ thread_id id = 0;
PCApplication::PCApplication() PCApplication::PCApplication()
: BApplication(kSignature) :
BApplication(kSignature)
{ {
} }
@@ -76,19 +78,21 @@ PCApplication::~PCApplication()
void void
PCApplication::ReadyToRun() PCApplication::ReadyToRun()
{ {
Preferences preferences(kPreferencesFileName);
int32 version = 0;
preferences.ReadInt32(version, kVersionName);
BDeskbar deskbar; BDeskbar deskbar;
bool hasOne = deskbar.HasItem(kDeskbarItemName); if (!deskbar.HasItem(kDeskbarItemName)) {
// We're not yet installed in the Deskbar, ask if we should
BAlert* alertInstall = NULL; BAlert* alert = new BAlert("",
if (!hasOne || (hasOne && version != kCurrentVersion)) {
alertInstall = new BAlert("",
"Do you want ProcessController to live in the Deskbar?", "Don't", "Do you want ProcessController to live in the Deskbar?", "Don't",
"Install", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); "Install", NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alertInstall->SetShortcut(0, B_ESCAPE); alert->SetShortcut(0, B_ESCAPE);
if (alert->Go() != 0) {
BDeskbar deskbar;
if (!deskbar.HasItem(kDeskbarItemName))
move_to_deskbar(deskbar);
Quit();
return;
}
} else { } else {
BAlert* alert = new BAlert("", BAlert* alert = new BAlert("",
"ProcessController is already installed in Deskbar.", "OK", NULL, "ProcessController is already installed in Deskbar.", "OK", NULL,
@@ -97,29 +101,6 @@ PCApplication::ReadyToRun()
alert->Go(); alert->Go();
} }
if (alertInstall != NULL && alertInstall->Go()) {
// Restart deskbar to make sure the new version is picked up
team_id deskbarTeam = be_roster->TeamFor(kDeskbarSig);
if (deskbarTeam >= 0) {
BMessenger messenger(NULL, deskbarTeam);
messenger.SendMessage(B_QUIT_REQUESTED);
int k = 500;
do {
snooze (10000);
} while (be_roster->IsRunning(kDeskbarSig) && k-- > 0);
}
be_roster->Launch(kDeskbarSig);
int k = 500;
do {
snooze (10000);
} while (!be_roster->IsRunning(kDeskbarSig) && k-- > 0);
BDeskbar deskbar;
if (!deskbar.HasItem(kDeskbarItemName))
move_to_deskbar(deskbar);
Quit();
return;
}
new PCWindow(); new PCWindow();
// quit other eventually running instances // quit other eventually running instances