| 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 "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 void FontsPageGtk::InitDefaultEncodingComboBox() { | 111 void FontsPageGtk::InitDefaultEncodingComboBox() { |
| 112 default_encoding_combobox_ = gtk_combo_box_new_text(); | 112 default_encoding_combobox_ = gtk_combo_box_new_text(); |
| 113 g_signal_connect(default_encoding_combobox_, "changed", | 113 g_signal_connect(default_encoding_combobox_, "changed", |
| 114 G_CALLBACK(OnDefaultEncodingChangedThunk), this); | 114 G_CALLBACK(OnDefaultEncodingChangedThunk), this); |
| 115 default_encoding_combobox_model_.reset(new DefaultEncodingComboboxModel); | 115 default_encoding_combobox_model_.reset(new DefaultEncodingComboboxModel); |
| 116 for (int i = 0; i < default_encoding_combobox_model_->GetItemCount(); ++i) { | 116 for (int i = 0; i < default_encoding_combobox_model_->GetItemCount(); ++i) { |
| 117 gtk_combo_box_append_text( | 117 gtk_combo_box_append_text( |
| 118 GTK_COMBO_BOX(default_encoding_combobox_), | 118 GTK_COMBO_BOX(default_encoding_combobox_), |
| 119 WideToUTF8(default_encoding_combobox_model_->GetItemAt(i)).c_str()); | 119 UTF16ToUTF8(default_encoding_combobox_model_->GetItemAt(i)).c_str()); |
| 120 } | 120 } |
| 121 } | 121 } |
| 122 | 122 |
| 123 void FontsPageGtk::NotifyPrefChanged(const std::string* pref_name) { | 123 void FontsPageGtk::NotifyPrefChanged(const std::string* pref_name) { |
| 124 if (!pref_name || *pref_name == prefs::kWebKitSerifFontFamily || | 124 if (!pref_name || *pref_name == prefs::kWebKitSerifFontFamily || |
| 125 *pref_name == prefs::kWebKitDefaultFontSize) { | 125 *pref_name == prefs::kWebKitDefaultFontSize) { |
| 126 gtk_font_button_set_font_name(GTK_FONT_BUTTON(serif_font_button_), | 126 gtk_font_button_set_font_name(GTK_FONT_BUTTON(serif_font_button_), |
| 127 MakeFontName(serif_name_.GetValue(), | 127 MakeFontName(serif_name_.GetValue(), |
| 128 variable_width_size_.GetValue()).c_str()); | 128 variable_width_size_.GetValue()).c_str()); |
| 129 } | 129 } |
| (...skipping 47 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(default_encoding_combobox_model_-> | 184 default_encoding_.SetValue(default_encoding_combobox_model_-> |
| 185 GetEncodingCharsetByIndex(index)); | 185 GetEncodingCharsetByIndex(index)); |
| 186 } | 186 } |
| OLD | NEW |