Hide the bookmark bar when there is no matching folder.
* Defaulting to the complete bookmark list doesn't make much sense * Don't crash when not showing the bar * Some style fixes.
This commit is contained in:
parent
4dc5ce8fd8
commit
47f04acb74
@ -499,10 +499,9 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
BDirectory barDir(&bookmarkRef);
|
BDirectory barDir(&bookmarkRef);
|
||||||
BEntry bookmarkBar(&barDir, "Bookmark bar");
|
BEntry bookmarkBar(&barDir, "Bookmark bar");
|
||||||
entry_ref bookmarkBarRef;
|
entry_ref bookmarkBarRef;
|
||||||
if (bookmarkBar.GetRef(&bookmarkBarRef) != B_OK)
|
// TODO we could also check if the folder is empty here.
|
||||||
bookmarkBarRef = bookmarkRef;
|
if (bookmarkBar.Exists() && bookmarkBar.GetRef(&bookmarkBarRef) == B_OK)
|
||||||
|
fBookmarkBar = new BookmarkBar("Bookmarks", this, &bookmarkBarRef);
|
||||||
fBookmarkBar = new BookmarkBar("Bookmarks", this, &bookmarkBarRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back, Forward, Stop & Home buttons
|
// Back, Forward, Stop & Home buttons
|
||||||
@ -609,7 +608,7 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
.Add(toggleFullscreenButton, 0.0f)
|
.Add(toggleFullscreenButton, 0.0f)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (fBookmarkBar) {
|
if (fBookmarkBar != NULL) {
|
||||||
if (fAppSettings->GetValue(kSettingsShowBookmarkBar, true)) {
|
if (fAppSettings->GetValue(kSettingsShowBookmarkBar, true)) {
|
||||||
// We need to hide the bookmark bar and then show it again
|
// We need to hide the bookmark bar and then show it again
|
||||||
// to save the setting and set the menu item label.
|
// to save the setting and set the menu item label.
|
||||||
@ -623,17 +622,20 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
false);
|
false);
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
AddChild(BLayoutBuilder::Group<>(B_VERTICAL, 0.0)
|
BGroupView* topView = new BGroupView(B_VERTICAL, 0.0);
|
||||||
|
|
||||||
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
#if !INTEGRATE_MENU_INTO_TAB_BAR
|
||||||
.Add(menuBarGroup)
|
topView->AddChild(menuBarGroup);
|
||||||
#endif
|
#endif
|
||||||
.Add(fTabManager->TabGroup())
|
topView->AddChild(fTabManager->TabGroup());
|
||||||
.Add(navigationGroup)
|
topView->AddChild(navigationGroup);
|
||||||
.Add(fBookmarkBar)
|
if (fBookmarkBar != NULL)
|
||||||
.Add(fTabManager->ContainerView())
|
topView->AddChild(fBookmarkBar);
|
||||||
.Add(findGroup)
|
topView->AddChild(fTabManager->ContainerView());
|
||||||
.Add(statusGroup)
|
topView->AddChild(findGroup);
|
||||||
);
|
topView->AddChild(statusGroup);
|
||||||
|
|
||||||
|
AddChild(topView);
|
||||||
|
|
||||||
fURLInputGroup->MakeFocus(true);
|
fURLInputGroup->MakeFocus(true);
|
||||||
|
|
||||||
@ -825,7 +827,7 @@ BrowserWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_HIDE_BOOKMARK_BAR:
|
case SHOW_HIDE_BOOKMARK_BAR:
|
||||||
if (fBookmarkBar)
|
if (fBookmarkBar != NULL)
|
||||||
_ShowBookmarkBar(fBookmarkBar->IsHidden());
|
_ShowBookmarkBar(fBookmarkBar->IsHidden());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user