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

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

Issue 155342: A little bit of bookmark bar cleanup, a little bit of padding improvement.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/bookmark_utils_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/gtk/bookmark_bar_gtk.cc
===================================================================
--- chrome/browser/gtk/bookmark_bar_gtk.cc (revision 20336)
+++ chrome/browser/gtk/bookmark_bar_gtk.cc (working copy)
@@ -85,8 +85,6 @@
if (model_)
model_->RemoveObserver(this);
- gtk_widget_set_sensitive(other_bookmarks_button_, false);
-
// TODO(erg): Handle extensions
model_ = profile_->GetBookmarkModel();
@@ -103,10 +101,6 @@
}
void BookmarkBarGtk::Init(Profile* profile) {
- // Load the default images from the resource bundle.
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- static GdkPixbuf* folder_icon = rb.GetPixbufNamed(IDR_BOOKMARK_BAR_FOLDER);
-
bookmark_hbox_.Own(gtk_hbox_new(FALSE, 0));
instructions_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
@@ -155,21 +149,6 @@
// we can have finer control over its label.
other_bookmarks_button_ = gtk_chrome_button_new();
ConnectFolderButtonEvents(other_bookmarks_button_);
- gtk_chrome_button_set_use_gtk_rendering(
- GTK_CHROME_BUTTON(other_bookmarks_button_),
- GtkThemeProvider::UseSystemThemeGraphics(profile));
-
- GtkWidget* image = gtk_image_new_from_pixbuf(folder_icon);
- other_bookmarks_label_ = gtk_label_new(
- l10n_util::GetStringUTF8(IDS_BOOMARK_BAR_OTHER_BOOKMARKED).c_str());
- GtkThemeProperties properties(profile);
- bookmark_utils::SetButtonTextColors(other_bookmarks_label_, &properties);
-
- GtkWidget* box = gtk_hbox_new(FALSE, bookmark_utils::kBarButtonPadding);
- gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(box), other_bookmarks_label_, FALSE, FALSE, 0);
- gtk_container_add(GTK_CONTAINER(other_bookmarks_button_), box);
-
gtk_box_pack_start(GTK_BOX(bookmark_hbox_.get()), other_bookmarks_button_,
FALSE, FALSE, 0);
@@ -230,13 +209,9 @@
// shutdown. Do nothing.
if (!instructions_)
return;
- RemoveAllBookmarkButtons();
- const BookmarkNode* node = model_->GetBookmarkBarNode();
- DCHECK(node && model_->other_node());
- CreateAllBookmarkButtons(node);
-
- gtk_widget_set_sensitive(other_bookmarks_button_, true);
+ RemoveAllBookmarkButtons();
+ CreateAllBookmarkButtons();
}
void BookmarkBarGtk::BookmarkModelBeingDeleted(BookmarkModel* model) {
@@ -271,7 +246,7 @@
gtk_toolbar_insert(GTK_TOOLBAR(bookmark_toolbar_.get()),
item, index);
- SetInstructionState(parent);
+ SetInstructionState();
}
void BookmarkBarGtk::BookmarkNodeRemoved(BookmarkModel* model,
@@ -288,7 +263,7 @@
gtk_container_remove(GTK_CONTAINER(bookmark_toolbar_.get()),
to_remove);
- SetInstructionState(parent);
+ SetInstructionState();
}
void BookmarkBarGtk::BookmarkNodeChanged(BookmarkModel* model,
@@ -319,22 +294,28 @@
// Purge and rebuild the bar.
RemoveAllBookmarkButtons();
- CreateAllBookmarkButtons(node);
+ CreateAllBookmarkButtons();
}
-void BookmarkBarGtk::CreateAllBookmarkButtons(const BookmarkNode* node) {
+void BookmarkBarGtk::CreateAllBookmarkButtons() {
+ const BookmarkNode* node = model_->GetBookmarkBarNode();
+ DCHECK(node && model_->other_node());
+
// Create a button for each of the children on the bookmark bar.
for (int i = 0; i < node->GetChildCount(); ++i) {
GtkToolItem* item = CreateBookmarkToolItem(node->GetChild(i));
gtk_toolbar_insert(GTK_TOOLBAR(bookmark_toolbar_.get()), item, -1);
}
- SetInstructionState(node);
+ GtkThemeProperties properties(profile_);
+ bookmark_utils::ConfigureButtonForNode(model_->other_node(),
+ model_, other_bookmarks_button_, &properties);
+
+ SetInstructionState();
}
-void BookmarkBarGtk::SetInstructionState(
- const BookmarkNode* boomarks_bar_node) {
- show_instructions_ = (boomarks_bar_node->GetChildCount() == 0);
+void BookmarkBarGtk::SetInstructionState() {
+ show_instructions_ = (model_->GetBookmarkBarNode()->GetChildCount() == 0);
if (show_instructions_) {
gtk_widget_show_all(instructions_);
} else {
@@ -359,19 +340,11 @@
}
void BookmarkBarGtk::UserChangedTheme(GtkThemeProperties* properties) {
- gtk_chrome_button_set_use_gtk_rendering(
- GTK_CHROME_BUTTON(other_bookmarks_button_),
- properties->use_gtk_rendering);
- bookmark_utils::SetButtonTextColors(other_bookmarks_label_, properties);
-
if (model_) {
// Regenerate the bookmark bar with all new objects with their theme
// properties set correctly for the new theme.
RemoveAllBookmarkButtons();
-
- const BookmarkNode* node = model_->GetBookmarkBarNode();
- DCHECK(node && model_->other_node());
- CreateAllBookmarkButtons(node);
+ CreateAllBookmarkButtons();
} else {
DLOG(ERROR) << "Received a theme change notification while we don't have a "
<< "BookmarkModel. Taking no action.";
« no previous file with comments | « chrome/browser/gtk/bookmark_bar_gtk.h ('k') | chrome/browser/gtk/bookmark_utils_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698