Skip to content

Commit

Permalink
Refactor Deskbar preferences window.
Browse files Browse the repository at this point in the history
* Remove locking from Prefs window QuitRequested(), thanks Axel.
* Remove kConfigClose message, no longer needed since window sticks
  around and is hidden on close instead of being deleted.
* delete fPreferencesWindow on BarApp QuitRequested() so it will
  remove the memory used by preference window when Deskbar quits.
  • Loading branch information
jscipione committed Dec 21, 2012
1 parent ee70bd8 commit 879fe42
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
5 changes: 1 addition & 4 deletions src/apps/deskbar/BarApp.cpp
Expand Up @@ -184,6 +184,7 @@ TBarApp::QuitRequested()
fPreferencesWindow->PostMessage(B_QUIT_REQUESTED);
fPreferencesWindow->Unlock();
}
delete fPreferencesWindow;
break;
}
}
Expand Down Expand Up @@ -480,10 +481,6 @@ TBarApp::MessageReceived(BMessage* message)
fSettings.recentDocsEnabled = enabled && count > 0;
break;

case kConfigClose:
fPreferencesWindow = NULL;
break;

case B_SOME_APP_LAUNCHED:
{
team_id team = -1;
Expand Down
12 changes: 1 addition & 11 deletions src/apps/deskbar/PreferencesWindow.cpp
Expand Up @@ -288,7 +288,6 @@ PreferencesWindow::PreferencesWindow(BRect frame)
PreferencesWindow::~PreferencesWindow()
{
UpdateRecentCounts();
be_app->PostMessage(kConfigClose);
}


Expand Down Expand Up @@ -327,19 +326,10 @@ PreferencesWindow::MessageReceived(BMessage* message)
bool
PreferencesWindow::QuitRequested()
{
bool isHidden = false;

if (Lock()) {
isHidden = IsHidden();
Unlock();
} else
return true;

if (isHidden)
if (IsHidden())
return true;

Hide();

return false;
}

Expand Down
1 change: 0 additions & 1 deletion src/apps/deskbar/PreferencesWindow.h
Expand Up @@ -10,7 +10,6 @@


const uint32 kConfigShow = 'show';
const uint32 kConfigClose = 'canc';
const uint32 kUpdateRecentCounts = 'upct';
const uint32 kEditMenuInTracker = 'mtrk';

Expand Down

0 comments on commit 879fe42

Please sign in to comment.