Bookmark bar uses "Bookmark bar" subfolder
* Allows having a lot of bookmarks in the menu, and only the most often used ones in the bar. * If the "Bookmark bar" folder doesn't exist, the old behavior (using the main Bookmarks folder for the bar as well as the menu) is used. * If none of these exists, the bookmark bar will not be available (just like the bookmark menu) Fixes #11092. We may want to update the default set of bookmark to include some links in the bar.
This commit is contained in:
@@ -360,7 +360,8 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
fZoomTextOnly(true),
|
fZoomTextOnly(true),
|
||||||
fShowTabsIfSinglePageOpen(true),
|
fShowTabsIfSinglePageOpen(true),
|
||||||
fAutoHideInterfaceInFullscreenMode(false),
|
fAutoHideInterfaceInFullscreenMode(false),
|
||||||
fAutoHidePointer(false)
|
fAutoHidePointer(false),
|
||||||
|
fBookmarkBar(NULL)
|
||||||
{
|
{
|
||||||
// Begin listening to settings changes and read some current values.
|
// Begin listening to settings changes and read some current values.
|
||||||
fAppSettings->AddListener(BMessenger(this));
|
fAppSettings->AddListener(BMessenger(this));
|
||||||
@@ -494,6 +495,14 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
BMenu* bookmarkMenu
|
BMenu* bookmarkMenu
|
||||||
= new BookmarkMenu(B_TRANSLATE("Bookmarks"), this, &bookmarkRef);
|
= new BookmarkMenu(B_TRANSLATE("Bookmarks"), this, &bookmarkRef);
|
||||||
mainMenu->AddItem(bookmarkMenu);
|
mainMenu->AddItem(bookmarkMenu);
|
||||||
|
|
||||||
|
BDirectory barDir(&bookmarkRef);
|
||||||
|
BEntry bookmarkBar(&barDir, "Bookmark bar");
|
||||||
|
entry_ref bookmarkBarRef;
|
||||||
|
if (bookmarkBar.GetRef(&bookmarkBarRef) != B_OK)
|
||||||
|
bookmarkBarRef = bookmarkRef;
|
||||||
|
|
||||||
|
fBookmarkBar = new BookmarkBar("Bookmarks", this, &bookmarkBarRef);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Back, Forward, Stop & Home buttons
|
// Back, Forward, Stop & Home buttons
|
||||||
@@ -600,14 +609,15 @@ BrowserWindow::BrowserWindow(BRect frame, SettingsMessage* appSettings,
|
|||||||
.Add(toggleFullscreenButton, 0.0f)
|
.Add(toggleFullscreenButton, 0.0f)
|
||||||
;
|
;
|
||||||
|
|
||||||
fBookmarkBar = new BookmarkBar("Bookmarks", this, &bookmarkRef);
|
if (fBookmarkBar) {
|
||||||
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.
|
||||||
fBookmarkBar->Hide();
|
fBookmarkBar->Hide();
|
||||||
_ShowBookmarkBar(true);
|
_ShowBookmarkBar(true);
|
||||||
} else
|
} else
|
||||||
_ShowBookmarkBar(false);
|
_ShowBookmarkBar(false);
|
||||||
|
}
|
||||||
|
|
||||||
fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), NULL, 0,
|
fSavePanel = new BFilePanel(B_SAVE_PANEL, new BMessenger(this), NULL, 0,
|
||||||
false);
|
false);
|
||||||
@@ -815,7 +825,8 @@ BrowserWindow::MessageReceived(BMessage* message)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_HIDE_BOOKMARK_BAR:
|
case SHOW_HIDE_BOOKMARK_BAR:
|
||||||
_ShowBookmarkBar(fBookmarkBar->IsHidden());
|
if (fBookmarkBar)
|
||||||
|
_ShowBookmarkBar(fBookmarkBar->IsHidden());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GOTO_URL:
|
case GOTO_URL:
|
||||||
|
|||||||
Reference in New Issue
Block a user