Simplified quitting. Propagate settings from window to application/settings when they change instead of collecting them when quitting.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34060 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -52,7 +52,6 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AboutRequested();
|
virtual void AboutRequested();
|
||||||
virtual bool QuitRequested();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Settings fSettings;
|
Settings fSettings;
|
||||||
@@ -187,19 +186,6 @@ LocalePreflet::AboutRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
LocalePreflet::QuitRequested()
|
|
||||||
{
|
|
||||||
if (fLocaleWindow != NULL) {
|
|
||||||
fLocaleWindow->PostMessage(B_QUIT_REQUESTED);
|
|
||||||
fLocaleWindow = NULL;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ extern const char* kSignature;
|
|||||||
|
|
||||||
static const uint32 kMsgCountrySelection = 'csel';
|
static const uint32 kMsgCountrySelection = 'csel';
|
||||||
static const uint32 kMsgSettingsChanged = 'SeCh';
|
static const uint32 kMsgSettingsChanged = 'SeCh';
|
||||||
static const uint32 kMsgSelectLanguage = 'slng';
|
static const uint32 kMsgPrefLanguagesChanged = 'lang';
|
||||||
static const uint32 kMsgDefaults = 'dflt';
|
static const uint32 kMsgDefaults = 'dflt';
|
||||||
static const uint32 kMsgRevert = 'revt';
|
static const uint32 kMsgRevert = 'revt';
|
||||||
|
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class LanguageListView: public BListView
|
|||||||
fDropIndex = -1;
|
fDropIndex = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Invoke(new BMessage(kMsgPrefLanguagesChanged));
|
||||||
} else BListView::MessageReceived(message);
|
} else BListView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
@@ -297,7 +298,8 @@ LanguageListView::MouseMoved(BPoint where, uint32 transit, const BMessage* msg)
|
|||||||
LocaleWindow::LocaleWindow()
|
LocaleWindow::LocaleWindow()
|
||||||
:
|
:
|
||||||
BWindow(BRect(0, 0, 0, 0), "Locale", B_TITLED_WINDOW, B_NOT_RESIZABLE
|
BWindow(BRect(0, 0, 0, 0), "Locale", B_TITLED_WINDOW, B_NOT_RESIZABLE
|
||||||
| B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS)
|
| B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS
|
||||||
|
| B_QUIT_ON_WINDOW_CLOSE)
|
||||||
{
|
{
|
||||||
BCountry* defaultCountry;
|
BCountry* defaultCountry;
|
||||||
be_locale_roster->GetDefaultCountry(&defaultCountry);
|
be_locale_roster->GetDefaultCountry(&defaultCountry);
|
||||||
@@ -453,27 +455,6 @@ LocaleWindow::LocaleWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
|
||||||
LocaleWindow::QuitRequested()
|
|
||||||
{
|
|
||||||
BMessage update(kMsgSettingsChanged);
|
|
||||||
update.AddPoint("window_location", Frame().LeftTop());
|
|
||||||
int index = 0;
|
|
||||||
while (index < fPreferredListView->CountItems()) {
|
|
||||||
update.AddString("language", static_cast<LanguageListItem*>
|
|
||||||
(fPreferredListView->ItemAt(index))->LanguageCode());
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
// TODO also save Country tab settings
|
|
||||||
be_app_messenger.SendMessage(&update);
|
|
||||||
|
|
||||||
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
|
|
||||||
be_app_messenger.SendMessage(B_QUIT_REQUESTED);
|
|
||||||
// app eats the first message
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocaleWindow::MessageReceived(BMessage* message)
|
LocaleWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -486,6 +467,19 @@ LocaleWindow::MessageReceived(BMessage* message)
|
|||||||
// TODO
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kMsgPrefLanguagesChanged:
|
||||||
|
{
|
||||||
|
BMessage update(kMsgSettingsChanged);
|
||||||
|
int index = 0;
|
||||||
|
while (index < fPreferredListView->CountItems()) {
|
||||||
|
update.AddString("language", static_cast<LanguageListItem*>
|
||||||
|
(fPreferredListView->ItemAt(index))->LanguageCode());
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
be_app_messenger.SendMessage(&update);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case kMsgCountrySelection:
|
case kMsgCountrySelection:
|
||||||
{
|
{
|
||||||
// Country selection changed.
|
// Country selection changed.
|
||||||
@@ -511,3 +505,12 @@ LocaleWindow::MessageReceived(BMessage* message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
LocaleWindow::FrameMoved(BPoint newPosition)
|
||||||
|
{
|
||||||
|
BMessage update(kMsgSettingsChanged);
|
||||||
|
update.AddPoint("window_location", newPosition);
|
||||||
|
be_app_messenger.SendMessage(&update);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ class LocaleWindow : public BWindow {
|
|||||||
public:
|
public:
|
||||||
LocaleWindow();
|
LocaleWindow();
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
virtual void FrameMoved(BPoint newPosition);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BButton* fRevertButton;
|
BButton* fRevertButton;
|
||||||
|
|||||||
Reference in New Issue
Block a user