OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/gtk/browser_toolbar_gtk.h" | 5 #include "chrome/browser/ui/gtk/browser_toolbar_gtk.h" |
6 | 6 |
7 #include <X11/XF86keysym.h> | 7 #include <X11/XF86keysym.h> |
8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
10 | 10 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 IDR_TOOLS, IDR_TOOLS_P, IDR_TOOLS_H, 0, | 204 IDR_TOOLS, IDR_TOOLS_P, IDR_TOOLS_H, 0, |
205 wrench_menu_image_)); | 205 wrench_menu_image_)); |
206 GtkWidget* wrench_button = wrench_menu_button_->widget(); | 206 GtkWidget* wrench_button = wrench_menu_button_->widget(); |
207 | 207 |
208 gtk_widget_set_tooltip_text( | 208 gtk_widget_set_tooltip_text( |
209 wrench_button, | 209 wrench_button, |
210 l10n_util::GetStringFUTF8(IDS_APPMENU_TOOLTIP, | 210 l10n_util::GetStringFUTF8(IDS_APPMENU_TOOLTIP, |
211 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); | 211 l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str()); |
212 g_signal_connect(wrench_button, "button-press-event", | 212 g_signal_connect(wrench_button, "button-press-event", |
213 G_CALLBACK(OnMenuButtonPressEventThunk), this); | 213 G_CALLBACK(OnMenuButtonPressEventThunk), this); |
214 GTK_WIDGET_UNSET_FLAGS(wrench_button, GTK_CAN_FOCUS); | 214 gtk_widget_set_can_focus(wrench_button, FALSE); |
215 | 215 |
216 // Put the wrench button in a box so that we can paint the update notification | 216 // Put the wrench button in a box so that we can paint the update notification |
217 // over it. | 217 // over it. |
218 GtkWidget* wrench_box = gtk_alignment_new(0, 0, 1, 1); | 218 GtkWidget* wrench_box = gtk_alignment_new(0, 0, 1, 1); |
219 g_signal_connect_after(wrench_box, "expose-event", | 219 g_signal_connect_after(wrench_box, "expose-event", |
220 G_CALLBACK(OnWrenchMenuButtonExposeThunk), this); | 220 G_CALLBACK(OnWrenchMenuButtonExposeThunk), this); |
221 gtk_container_add(GTK_CONTAINER(wrench_box), wrench_button); | 221 gtk_container_add(GTK_CONTAINER(wrench_box), wrench_button); |
222 gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4); | 222 gtk_box_pack_start(GTK_BOX(toolbar_), wrench_box, FALSE, FALSE, 4); |
223 | 223 |
224 wrench_menu_.reset(new MenuGtk(this, &wrench_menu_model_)); | 224 wrench_menu_.reset(new MenuGtk(this, &wrench_menu_model_)); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 break; | 294 break; |
295 case IDC_FORWARD: | 295 case IDC_FORWARD: |
296 widget = forward_->widget(); | 296 widget = forward_->widget(); |
297 break; | 297 break; |
298 case IDC_HOME: | 298 case IDC_HOME: |
299 if (home_.get()) | 299 if (home_.get()) |
300 widget = home_->widget(); | 300 widget = home_->widget(); |
301 break; | 301 break; |
302 } | 302 } |
303 if (widget) { | 303 if (widget) { |
304 if (!enabled && GTK_WIDGET_STATE(widget) == GTK_STATE_PRELIGHT) { | 304 if (!enabled && gtk_widget_get_state(widget) == GTK_STATE_PRELIGHT) { |
305 // If we're disabling a widget, GTK will helpfully restore it to its | 305 // If we're disabling a widget, GTK will helpfully restore it to its |
306 // previous state when we re-enable it, even if that previous state | 306 // previous state when we re-enable it, even if that previous state |
307 // is the prelight. This looks bad. See the bug for a simple repro. | 307 // is the prelight. This looks bad. See the bug for a simple repro. |
308 // http://code.google.com/p/chromium/issues/detail?id=13729 | 308 // http://code.google.com/p/chromium/issues/detail?id=13729 |
309 gtk_widget_set_state(widget, GTK_STATE_NORMAL); | 309 gtk_widget_set_state(widget, GTK_STATE_NORMAL); |
310 } | 310 } |
311 gtk_widget_set_sensitive(widget, enabled); | 311 gtk_widget_set_sensitive(widget, enabled); |
312 } | 312 } |
313 } | 313 } |
314 | 314 |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
650 int x_offset = base::i18n::IsRTL() ? 0 : | 650 int x_offset = base::i18n::IsRTL() ? 0 : |
651 sender->allocation.width - badge->width(); | 651 sender->allocation.width - badge->width(); |
652 int y_offset = 0; | 652 int y_offset = 0; |
653 canvas.DrawBitmapInt( | 653 canvas.DrawBitmapInt( |
654 *badge, | 654 *badge, |
655 sender->allocation.x + x_offset, | 655 sender->allocation.x + x_offset, |
656 sender->allocation.y + y_offset); | 656 sender->allocation.y + y_offset); |
657 | 657 |
658 return FALSE; | 658 return FALSE; |
659 } | 659 } |
OLD | NEW |