| 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/bookmarks/bookmark_bar_instructions_gtk.h" | 5 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bar_instructions_gtk.h" |
| 6 | 6 |
| 7 #include "base/observer_list.h" | 7 #include "base/observer_list.h" |
| 8 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" | 8 #include "chrome/browser/ui/gtk/gtk_chrome_link_button.h" |
| 9 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" | 9 #include "chrome/browser/ui/gtk/gtk_chrome_shrinkable_hbox.h" |
| 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" | 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" |
| 11 #include "chrome/browser/ui/gtk/gtk_util.h" | 11 #include "chrome/browser/ui/gtk/gtk_util.h" |
| 12 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "content/common/notification_service.h" | 13 #include "content/common/notification_service.h" |
| 13 #include "grit/generated_resources.h" | 14 #include "grit/generated_resources.h" |
| 14 #include "ui/base/l10n/l10n_util.h" | 15 #include "ui/base/l10n/l10n_util.h" |
| 15 | 16 |
| 16 BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, | 17 BookmarkBarInstructionsGtk::BookmarkBarInstructionsGtk(Delegate* delegate, |
| 17 Profile* profile) | 18 Profile* profile) |
| 18 : delegate_(delegate), | 19 : delegate_(delegate), |
| 19 profile_(profile), | 20 profile_(profile), |
| 20 theme_service_(GtkThemeService::GetFrom(profile_)) { | 21 theme_service_(GtkThemeService::GetFrom(profile_)) { |
| 21 instructions_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, 0); | 22 instructions_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE, 0); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 // Until we switch to vector graphics, force the font size. | 41 // Until we switch to vector graphics, force the font size. |
| 41 // 13.4px == 10pt @ 96dpi | 42 // 13.4px == 10pt @ 96dpi |
| 42 gtk_util::ForceFontSizePixels( | 43 gtk_util::ForceFontSizePixels( |
| 43 GTK_CHROME_LINK_BUTTON(instructions_link_)->label, 13.4); | 44 GTK_CHROME_LINK_BUTTON(instructions_link_)->label, 13.4); |
| 44 gtk_util::CenterWidgetInHBox(instructions_hbox_, instructions_link_, | 45 gtk_util::CenterWidgetInHBox(instructions_hbox_, instructions_link_, |
| 45 false, 6); | 46 false, 6); |
| 46 g_signal_connect(GTK_CHROME_LINK_BUTTON(instructions_link_)->label, "map", | 47 g_signal_connect(GTK_CHROME_LINK_BUTTON(instructions_link_)->label, "map", |
| 47 G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode), | 48 G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode), |
| 48 NULL); | 49 NULL); |
| 49 | 50 |
| 50 registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED, | 51 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 51 Source<ThemeService>(theme_service_)); | 52 Source<ThemeService>(theme_service_)); |
| 52 theme_service_->InitThemesFor(this); | 53 theme_service_->InitThemesFor(this); |
| 53 } | 54 } |
| 54 | 55 |
| 55 void BookmarkBarInstructionsGtk::Observe(NotificationType type, | 56 void BookmarkBarInstructionsGtk::Observe(int type, |
| 56 const NotificationSource& source, | 57 const NotificationSource& source, |
| 57 const NotificationDetails& details) { | 58 const NotificationDetails& details) { |
| 58 if (type == NotificationType::BROWSER_THEME_CHANGED) | 59 if (type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED) |
| 59 UpdateColors(); | 60 UpdateColors(); |
| 60 } | 61 } |
| 61 | 62 |
| 62 void BookmarkBarInstructionsGtk::OnButtonClick(GtkWidget* button) { | 63 void BookmarkBarInstructionsGtk::OnButtonClick(GtkWidget* button) { |
| 63 delegate_->ShowImportDialog(); | 64 delegate_->ShowImportDialog(); |
| 64 } | 65 } |
| 65 | 66 |
| 66 void BookmarkBarInstructionsGtk::UpdateColors() { | 67 void BookmarkBarInstructionsGtk::UpdateColors() { |
| 67 GdkColor bookmark_color = theme_service_->GetGdkColor( | 68 GdkColor bookmark_color = theme_service_->GetGdkColor( |
| 68 ThemeService::COLOR_BOOKMARK_TEXT); | 69 ThemeService::COLOR_BOOKMARK_TEXT); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 80 ThemeService::GetDefaultColor( | 81 ThemeService::GetDefaultColor( |
| 81 ThemeService::COLOR_BOOKMARK_TEXT)) { | 82 ThemeService::COLOR_BOOKMARK_TEXT)) { |
| 82 gtk_chrome_link_button_set_normal_color( | 83 gtk_chrome_link_button_set_normal_color( |
| 83 GTK_CHROME_LINK_BUTTON(instructions_link_), NULL); | 84 GTK_CHROME_LINK_BUTTON(instructions_link_), NULL); |
| 84 } else { | 85 } else { |
| 85 gtk_chrome_link_button_set_normal_color( | 86 gtk_chrome_link_button_set_normal_color( |
| 86 GTK_CHROME_LINK_BUTTON(instructions_link_), &bookmark_color); | 87 GTK_CHROME_LINK_BUTTON(instructions_link_), &bookmark_color); |
| 87 } | 88 } |
| 88 } | 89 } |
| 89 } | 90 } |
| OLD | NEW |