Skip to content

Commit

Permalink
Implement Revert and Default buttons in Deskbar prefs
Browse files Browse the repository at this point in the history
  • Loading branch information
jscipione committed Mar 16, 2013
1 parent 93a58e5 commit cb0602c
Show file tree
Hide file tree
Showing 4 changed files with 356 additions and 70 deletions.
20 changes: 19 additions & 1 deletion src/apps/deskbar/BarApp.cpp
Expand Up @@ -485,6 +485,8 @@ TBarApp::MessageReceived(BMessage* message)
fSettings.recentDocsCount = count;
if (message->FindBool("documentsEnabled", &enabled) == B_OK)
fSettings.recentDocsEnabled = enabled && count > 0;

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case B_SOME_APP_LAUNCHED:
Expand Down Expand Up @@ -530,12 +532,14 @@ TBarApp::MessageReceived(BMessage* message)
fSettings.alwaysOnTop = !fSettings.alwaysOnTop;
fBarWindow->SetFeel(fSettings.alwaysOnTop ?
B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
fPreferencesWindow->PostMessage(kStateChanged);
fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kAutoRaise:
fSettings.autoRaise = fSettings.alwaysOnTop ? false :
!fSettings.autoRaise;

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kAutoHide:
Expand All @@ -544,6 +548,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->HideDeskbar(fSettings.autoHide);
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kTrackerFirst:
Expand All @@ -552,6 +558,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->PlaceApplicationBar();
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kSortRunningApps:
Expand All @@ -560,6 +568,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->PlaceApplicationBar();
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kUnsubscribe:
Expand All @@ -576,6 +586,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->PlaceApplicationBar();
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kExpandNewTeams:
Expand All @@ -584,6 +596,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->PlaceApplicationBar();
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kHideLabels:
Expand All @@ -592,6 +606,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarWindow->Lock();
fBarView->PlaceApplicationBar();
fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;

case kResizeTeamIcons:
Expand Down Expand Up @@ -620,6 +636,8 @@ TBarApp::MessageReceived(BMessage* message)
fBarView->UpdatePlacement();

fBarWindow->Unlock();

fPreferencesWindow->PostMessage(kUpdatePreferences);
break;
}

Expand Down
3 changes: 3 additions & 0 deletions src/apps/deskbar/BarApp.h
Expand Up @@ -69,6 +69,9 @@ const int32 kMinimumIconSize = 16;
const int32 kMaximumIconSize = 96;
const int32 kIconSizeInterval = 8;

// update preferences message constant
const uint32 kUpdatePreferences = 'Pref';

/* --------------------------------------------- */

struct desk_settings {
Expand Down

0 comments on commit cb0602c

Please sign in to comment.