Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Unified Diff: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc

Issue 7312014: GTK: Hide the "Other Bookmarks" button when there are no bookmarks there. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
index 893aee7f72b03105a89efd70e258118859c010f9..83c5b954b8c5bdee3082e7a066cc46abd2b79506 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.cc
@@ -264,8 +264,8 @@ void BookmarkBarGtk::Init(Profile* profile) {
g_signal_connect(bookmark_toolbar_.get(), "drag-data-received",
G_CALLBACK(&OnDragReceivedThunk), this);
- GtkWidget* vseparator = theme_service_->CreateToolbarSeparator();
- gtk_box_pack_start(GTK_BOX(bookmark_hbox_), vseparator,
+ other_bookmarks_separator_ = theme_service_->CreateToolbarSeparator();
+ gtk_box_pack_start(GTK_BOX(bookmark_hbox_), other_bookmarks_separator_,
FALSE, FALSE, 0);
// We pack the button manually (rather than using gtk_button_set_*) so that
@@ -539,6 +539,15 @@ void BookmarkBarGtk::SetChevronState() {
gtk_widget_show_all(overflow_button_);
}
+void BookmarkBarGtk::UpdateOtherBookmarksVisibility() {
+ bool has_other_children = !model_->other_node()->empty();
+ if (has_other_children == gtk_widget_get_visible(other_bookmarks_button_))
+ return;
+
+ gtk_widget_set_visible(other_bookmarks_button_, has_other_children);
+ gtk_widget_set_visible(other_bookmarks_separator_, has_other_children);
+}
+
void BookmarkBarGtk::RemoveAllBookmarkButtons() {
gtk_util::RemoveAllChildren(bookmark_toolbar_.get());
menu_bar_helper_.Clear();
@@ -828,6 +837,7 @@ void BookmarkBarGtk::Loaded(BookmarkModel* model) {
if (!instructions_)
return;
+ UpdateOtherBookmarksVisibility();
RemoveAllBookmarkButtons();
CreateAllBookmarkButtons();
}
@@ -869,6 +879,7 @@ void BookmarkBarGtk::BookmarkNodeAdded(BookmarkModel* model,
if (node->is_folder())
menu_bar_helper_.Add(gtk_bin_get_child(GTK_BIN(item)));
+ UpdateOtherBookmarksVisibility();
SetInstructionState();
SetChevronState();
@@ -892,6 +903,7 @@ void BookmarkBarGtk::BookmarkNodeRemoved(BookmarkModel* model,
gtk_container_remove(GTK_CONTAINER(bookmark_toolbar_.get()),
to_remove);
+ UpdateOtherBookmarksVisibility();
SetInstructionState();
SetChevronState();
}
« no previous file with comments | « chrome/browser/ui/gtk/bookmarks/bookmark_bar_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698