OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/options/fonts_page_gtk.h" | 5 #include "chrome/browser/gtk/options/fonts_page_gtk.h" |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
8 #include "app/l10n_util_collator.h" | 8 #include "app/l10n_util_collator.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/default_encoding_combo_model.h" | 10 #include "chrome/browser/default_encoding_combo_model.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 } // namespace | 36 } // namespace |
37 | 37 |
38 FontsPageGtk::FontsPageGtk(Profile* profile) : OptionsPageBase(profile) { | 38 FontsPageGtk::FontsPageGtk(Profile* profile) : OptionsPageBase(profile) { |
39 Init(); | 39 Init(); |
40 } | 40 } |
41 | 41 |
42 FontsPageGtk::~FontsPageGtk() { | 42 FontsPageGtk::~FontsPageGtk() { |
43 } | 43 } |
44 | 44 |
45 void FontsPageGtk::Init() { | 45 void FontsPageGtk::Init() { |
46 OptionsLayoutBuilderGtk options_builder; | 46 scoped_ptr<OptionsLayoutBuilderGtk> |
47 | 47 options_builder(OptionsLayoutBuilderGtk::Create()); |
48 serif_font_button_ = gtk_font_button_new(); | 48 serif_font_button_ = gtk_font_button_new(); |
49 gtk_font_button_set_use_font(GTK_FONT_BUTTON(serif_font_button_), TRUE); | 49 gtk_font_button_set_use_font(GTK_FONT_BUTTON(serif_font_button_), TRUE); |
50 gtk_font_button_set_use_size(GTK_FONT_BUTTON(serif_font_button_), TRUE); | 50 gtk_font_button_set_use_size(GTK_FONT_BUTTON(serif_font_button_), TRUE); |
51 g_signal_connect(serif_font_button_, "font-set", | 51 g_signal_connect(serif_font_button_, "font-set", |
52 G_CALLBACK(OnSerifFontSetThunk), this); | 52 G_CALLBACK(OnSerifFontSetThunk), this); |
53 | 53 |
54 sans_font_button_ = gtk_font_button_new(); | 54 sans_font_button_ = gtk_font_button_new(); |
55 gtk_font_button_set_use_font(GTK_FONT_BUTTON(sans_font_button_), TRUE); | 55 gtk_font_button_set_use_font(GTK_FONT_BUTTON(sans_font_button_), TRUE); |
56 gtk_font_button_set_use_size(GTK_FONT_BUTTON(sans_font_button_), TRUE); | 56 gtk_font_button_set_use_size(GTK_FONT_BUTTON(sans_font_button_), TRUE); |
57 g_signal_connect(sans_font_button_, "font-set", | 57 g_signal_connect(sans_font_button_, "font-set", |
(...skipping 10 matching lines...) Expand all Loading... |
68 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL).c_str(), | 68 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL).c_str(), |
69 serif_font_button_, | 69 serif_font_button_, |
70 l10n_util::GetStringUTF8( | 70 l10n_util::GetStringUTF8( |
71 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL).c_str(), | 71 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL).c_str(), |
72 sans_font_button_, | 72 sans_font_button_, |
73 l10n_util::GetStringUTF8( | 73 l10n_util::GetStringUTF8( |
74 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL).c_str(), | 74 IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL).c_str(), |
75 fixed_font_button_, | 75 fixed_font_button_, |
76 NULL); | 76 NULL); |
77 | 77 |
78 options_builder.AddOptionGroup(l10n_util::GetStringUTF8( | 78 options_builder->AddOptionGroup(l10n_util::GetStringUTF8( |
79 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_FONT_TITLE), | 79 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_FONT_TITLE), |
80 font_controls, false); | 80 font_controls, false); |
81 | 81 |
82 InitDefaultEncodingComboBox(); | 82 InitDefaultEncodingComboBox(); |
83 std::string encoding_group_description = l10n_util::GetStringUTF8( | 83 std::string encoding_group_description = l10n_util::GetStringUTF8( |
84 IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL); | 84 IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL); |
85 GtkWidget* encoding_controls = gtk_util::CreateLabeledControlsGroup(NULL, | 85 GtkWidget* encoding_controls = gtk_util::CreateLabeledControlsGroup(NULL, |
86 encoding_group_description.c_str(), | 86 encoding_group_description.c_str(), |
87 default_encoding_combobox_, | 87 default_encoding_combobox_, |
88 NULL); | 88 NULL); |
89 options_builder.AddOptionGroup(l10n_util::GetStringUTF8( | 89 options_builder->AddOptionGroup(l10n_util::GetStringUTF8( |
90 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE), | 90 IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE), |
91 encoding_controls, false); | 91 encoding_controls, false); |
92 | 92 |
93 page_ = options_builder.get_page_widget(); | 93 page_ = options_builder->get_page_widget(); |
94 | 94 |
95 serif_name_.Init(prefs::kWebKitSerifFontFamily, profile()->GetPrefs(), this); | 95 serif_name_.Init(prefs::kWebKitSerifFontFamily, profile()->GetPrefs(), this); |
96 sans_serif_name_.Init(prefs::kWebKitSansSerifFontFamily, | 96 sans_serif_name_.Init(prefs::kWebKitSansSerifFontFamily, |
97 profile()->GetPrefs(), this); | 97 profile()->GetPrefs(), this); |
98 variable_width_size_.Init(prefs::kWebKitDefaultFontSize, | 98 variable_width_size_.Init(prefs::kWebKitDefaultFontSize, |
99 profile()->GetPrefs(), this); | 99 profile()->GetPrefs(), this); |
100 | 100 |
101 fixed_width_name_.Init(prefs::kWebKitFixedFontFamily, profile()->GetPrefs(), | 101 fixed_width_name_.Init(prefs::kWebKitFixedFontFamily, profile()->GetPrefs(), |
102 this); | 102 this); |
103 fixed_width_size_.Init(prefs::kWebKitDefaultFixedFontSize, | 103 fixed_width_size_.Init(prefs::kWebKitDefaultFixedFontSize, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 SetFontsFromButton(&fixed_width_name_, | 177 SetFontsFromButton(&fixed_width_name_, |
178 &fixed_width_size_, | 178 &fixed_width_size_, |
179 font_button); | 179 font_button); |
180 } | 180 } |
181 | 181 |
182 void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) { | 182 void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) { |
183 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); | 183 int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); |
184 default_encoding_.SetValue(ASCIIToWide(default_encoding_combobox_model_-> | 184 default_encoding_.SetValue(ASCIIToWide(default_encoding_combobox_model_-> |
185 GetEncodingCharsetByIndex(index))); | 185 GetEncodingCharsetByIndex(index))); |
186 } | 186 } |
OLD | NEW |