OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" | 5 #include "chrome/browser/gtk/bookmark_bar_gtk.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "app/gfx/text_elider.h" | 9 #include "app/gfx/text_elider.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 g_signal_connect(bookmark_toolbar_.get(), "drag-drop", | 143 g_signal_connect(bookmark_toolbar_.get(), "drag-drop", |
144 G_CALLBACK(&OnToolbarDragDrop), this); | 144 G_CALLBACK(&OnToolbarDragDrop), this); |
145 g_signal_connect(bookmark_toolbar_.get(), "drag-data-received", | 145 g_signal_connect(bookmark_toolbar_.get(), "drag-data-received", |
146 G_CALLBACK(&OnToolbarDragReceived), this); | 146 G_CALLBACK(&OnToolbarDragReceived), this); |
147 g_signal_connect(bookmark_toolbar_.get(), "button-press-event", | 147 g_signal_connect(bookmark_toolbar_.get(), "button-press-event", |
148 G_CALLBACK(&OnButtonPressed), this); | 148 G_CALLBACK(&OnButtonPressed), this); |
149 | 149 |
150 gtk_box_pack_start(GTK_BOX(bookmark_hbox_.get()), gtk_vseparator_new(), | 150 gtk_box_pack_start(GTK_BOX(bookmark_hbox_.get()), gtk_vseparator_new(), |
151 FALSE, FALSE, 0); | 151 FALSE, FALSE, 0); |
152 | 152 |
| 153 // We pack the button manually (rather than using gtk_button_set_*) so that |
| 154 // we can have finer control over its label. |
153 other_bookmarks_button_ = gtk_chrome_button_new(); | 155 other_bookmarks_button_ = gtk_chrome_button_new(); |
154 ConnectFolderButtonEvents(other_bookmarks_button_); | 156 ConnectFolderButtonEvents(other_bookmarks_button_); |
155 gtk_button_set_label( | 157 |
156 GTK_BUTTON(other_bookmarks_button_), | 158 GtkWidget* image = gtk_image_new_from_pixbuf(folder_icon); |
| 159 GtkWidget* label = gtk_label_new( |
157 l10n_util::GetStringUTF8(IDS_BOOMARK_BAR_OTHER_BOOKMARKED).c_str()); | 160 l10n_util::GetStringUTF8(IDS_BOOMARK_BAR_OTHER_BOOKMARKED).c_str()); |
158 gtk_button_set_image(GTK_BUTTON(other_bookmarks_button_), | 161 bookmark_utils::SetButtonTextColors(label); |
159 gtk_image_new_from_pixbuf(folder_icon)); | 162 |
160 // Set the proper text colors. | 163 GtkWidget* box = gtk_hbox_new(FALSE, bookmark_utils::kBarButtonPadding); |
161 bookmark_utils::SetButtonTextColors(other_bookmarks_button_); | 164 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
| 165 gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 0); |
| 166 gtk_container_add(GTK_CONTAINER(other_bookmarks_button_), box); |
162 | 167 |
163 gtk_box_pack_start(GTK_BOX(bookmark_hbox_.get()), other_bookmarks_button_, | 168 gtk_box_pack_start(GTK_BOX(bookmark_hbox_.get()), other_bookmarks_button_, |
164 FALSE, FALSE, 0); | 169 FALSE, FALSE, 0); |
165 gtk_widget_set_size_request(bookmark_hbox_.get(), -1, 0); | 170 gtk_widget_set_size_request(bookmark_hbox_.get(), -1, 0); |
166 | 171 |
167 slide_animation_.reset(new SlideAnimation(this)); | 172 slide_animation_.reset(new SlideAnimation(this)); |
168 } | 173 } |
169 | 174 |
170 void BookmarkBarGtk::AddBookmarkbarToBox(GtkWidget* box) { | 175 void BookmarkBarGtk::AddBookmarkbarToBox(GtkWidget* box) { |
171 gtk_box_pack_start(GTK_BOX(box), bookmark_hbox_.get(), FALSE, FALSE, 0); | 176 gtk_box_pack_start(GTK_BOX(box), bookmark_hbox_.get(), FALSE, FALSE, 0); |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 bar->InitBackground(); | 746 bar->InitBackground(); |
742 gfx::Point tabstrip_origin = | 747 gfx::Point tabstrip_origin = |
743 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); | 748 bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); |
744 bar->background_ninebox_->RenderTopCenterStrip( | 749 bar->background_ninebox_->RenderTopCenterStrip( |
745 cr, tabstrip_origin.x(), tabstrip_origin.y(), | 750 cr, tabstrip_origin.x(), tabstrip_origin.y(), |
746 event->area.x + event->area.width - tabstrip_origin.x()); | 751 event->area.x + event->area.width - tabstrip_origin.x()); |
747 cairo_destroy(cr); | 752 cairo_destroy(cr); |
748 | 753 |
749 return FALSE; // Propagate expose to children. | 754 return FALSE; // Propagate expose to children. |
750 } | 755 } |
OLD | NEW |