Add a setting to show or hide the Home button. I find it pretty useless myself.

While I was able to add this fairly easily by cutting and pasting, it was still
quite a bit of work. Seems like there should be a less-verbose way of doing
this. But it did work the first time I tested, so I can't complain too much.

git-svn-id: http://svn.haiku-os.org/webpositive/webkit/trunk@566 94f232f2-1747-11df-bad5-a5bfde151594
This commit is contained in:
leavengood 2010-12-30 06:34:45 +00:00 committed by Alexandre Deckner
parent 0afc39c5b1
commit 1220bcc0af
5 changed files with 26 additions and 0 deletions

View File

@ -387,6 +387,8 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
fHomeButton = new IconButton("Home", 0, NULL, new BMessage(HOME));
fHomeButton->SetIcon(206);
fHomeButton->TrimIcon();
if (!fAppSettings->GetValue(kSettingsKeyShowHomeButton, true))
fHomeButton->Hide();
// URL input group
fURLInputGroup = new URLInputGroup(new BMessage(GOTO_URL));
@ -929,6 +931,12 @@ BrowserWindow::MessageReceived(BMessage* message)
} else if (name == kSettingsKeyAutoHideInterfaceInFullscreenMode
&& message->FindBool("value", &flag) == B_OK) {
_SetAutoHideInterfaceInFullscreen(flag);
} else if (name == kSettingsKeyShowHomeButton
&& message->FindBool("value", &flag) == B_OK) {
if (flag)
fHomeButton->Show();
else
fHomeButton->Hide();
}
break;
}

View File

@ -33,6 +33,7 @@ const char* kSettingsKeyShowTabsIfSinglePageOpen
const char* kSettingsKeyAutoHideInterfaceInFullscreenMode
= "auto hide interface in full screen mode";
const char* kSettingsKeyAutoHidePointer = "auto hide pointer";
const char* kSettingsKeyShowHomeButton = "show home button";
const char* kSettingsKeyNewWindowPolicy = "new window policy";
const char* kSettingsKeyNewTabPolicy = "new tab policy";

View File

@ -34,6 +34,7 @@ extern const char* kSettingsKeyDownloadPath;
extern const char* kSettingsKeyShowTabsIfSinglePageOpen;
extern const char* kSettingsKeyAutoHideInterfaceInFullscreenMode;
extern const char* kSettingsKeyAutoHidePointer;
extern const char* kSettingsKeyShowHomeButton;
extern const char* kSettingsKeyNewWindowPolicy;
extern const char* kSettingsKeyNewTabPolicy;

View File

@ -73,6 +73,7 @@ enum {
MSG_TAB_DISPLAY_BEHAVIOR_CHANGED = 'tdbc',
MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED = 'ahic',
MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED = 'ahpc',
MSG_SHOW_HOME_BUTTON_CHANGED = 'shbc',
MSG_STANDARD_FONT_CHANGED = 'stfc',
MSG_SERIF_FONT_CHANGED = 'sefc',
@ -203,6 +204,7 @@ SettingsWindow::MessageReceived(BMessage* message)
case MSG_TAB_DISPLAY_BEHAVIOR_CHANGED:
case MSG_AUTO_HIDE_INTERFACE_BEHAVIOR_CHANGED:
case MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED:
case MSG_SHOW_HOME_BUTTON_CHANGED:
case MSG_STANDARD_FONT_CHANGED:
case MSG_SERIF_FONT_CHANGED:
case MSG_SANS_SERIF_FONT_CHANGED:
@ -338,6 +340,11 @@ SettingsWindow::_CreateGeneralPage(float spacing)
new BMessage(MSG_AUTO_HIDE_POINTER_BEHAVIOR_CHANGED));
fAutoHidePointer->SetValue(B_CONTROL_OFF);
fShowHomeButton = new BCheckBox("show home button",
B_TRANSLATE("Show Home Button"),
new BMessage(MSG_SHOW_HOME_BUTTON_CHANGED));
fShowHomeButton->SetValue(B_CONTROL_ON);
BView* view = BGroupLayoutBuilder(B_VERTICAL, spacing / 2)
.Add(BGridLayoutBuilder(spacing / 2, spacing / 2)
.Add(fStartPageControl->CreateLabelLayoutItem(), 0, 0)
@ -361,6 +368,7 @@ SettingsWindow::_CreateGeneralPage(float spacing)
.Add(fShowTabsIfOnlyOnePage)
.Add(fAutoHideInterfaceInFullscreenMode)
.Add(fAutoHidePointer)
.Add(fShowHomeButton)
.Add(fDaysInHistoryMenuControl)
.Add(BSpaceLayoutItem::CreateHorizontalStrut(spacing))
@ -547,6 +555,9 @@ SettingsWindow::_CanApplySettings() const
(fAutoHidePointer->Value() == B_CONTROL_ON)
!= fSettings->GetValue(kSettingsKeyAutoHidePointer, false));
canApply = canApply || ((fShowHomeButton->Value() == B_CONTROL_ON)
!= fSettings->GetValue(kSettingsKeyShowHomeButton, true));
canApply = canApply || (_MaxHistoryAge()
!= BrowsingHistory::DefaultInstance()->MaxHistoryItemAge());
@ -612,6 +623,8 @@ SettingsWindow::_ApplySettings()
fAutoHideInterfaceInFullscreenMode->Value() == B_CONTROL_ON);
fSettings->SetValue(kSettingsKeyAutoHidePointer,
fAutoHidePointer->Value() == B_CONTROL_ON);
fSettings->SetValue(kSettingsKeyShowHomeButton,
fShowHomeButton->Value() == B_CONTROL_ON);
// New page policies
fSettings->SetValue(kSettingsKeyNewWindowPolicy, _NewWindowPolicy());
@ -679,6 +692,8 @@ SettingsWindow::_RevertSettings()
false));
fAutoHidePointer->SetValue(
fSettings->GetValue(kSettingsKeyAutoHidePointer, false));
fShowHomeButton->SetValue(
fSettings->GetValue(kSettingsKeyShowHomeButton, true));
BString text;
text << BrowsingHistory::DefaultInstance()->MaxHistoryItemAge();

View File

@ -98,6 +98,7 @@ private:
BCheckBox* fShowTabsIfOnlyOnePage;
BCheckBox* fAutoHideInterfaceInFullscreenMode;
BCheckBox* fAutoHidePointer;
BCheckBox* fShowHomeButton;
FontSelectionView* fStandardFontView;
FontSelectionView* fSerifFontView;