summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/options/fonts_page_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/gtk/options/fonts_page_gtk.cc')
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.cc63
1 files changed, 36 insertions, 27 deletions
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc
index 9a8eafb..941e252 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.cc
+++ b/chrome/browser/gtk/options/fonts_page_gtk.cc
@@ -47,20 +47,20 @@ void FontsPageGtk::Init() {
serif_font_button_ = gtk_font_button_new();
gtk_font_button_set_use_font(GTK_FONT_BUTTON(serif_font_button_), TRUE);
gtk_font_button_set_use_size(GTK_FONT_BUTTON(serif_font_button_), TRUE);
- g_signal_connect(serif_font_button_, "font-set",
- G_CALLBACK(OnSerifFontSetThunk), this);
+ g_signal_connect(serif_font_button_, "font-set", G_CALLBACK(OnSerifFontSet),
+ this);
sans_font_button_ = gtk_font_button_new();
gtk_font_button_set_use_font(GTK_FONT_BUTTON(sans_font_button_), TRUE);
gtk_font_button_set_use_size(GTK_FONT_BUTTON(sans_font_button_), TRUE);
- g_signal_connect(sans_font_button_, "font-set",
- G_CALLBACK(OnSansFontSetThunk), this);
+ g_signal_connect(sans_font_button_, "font-set", G_CALLBACK(OnSansFontSet),
+ this);
fixed_font_button_ = gtk_font_button_new();
gtk_font_button_set_use_font(GTK_FONT_BUTTON(fixed_font_button_), TRUE);
gtk_font_button_set_use_size(GTK_FONT_BUTTON(fixed_font_button_), TRUE);
- g_signal_connect(fixed_font_button_, "font-set",
- G_CALLBACK(OnFixedFontSetThunk), this);
+ g_signal_connect(fixed_font_button_, "font-set", G_CALLBACK(OnFixedFontSet),
+ this);
GtkWidget* font_controls = gtk_util::CreateLabeledControlsGroup(NULL,
l10n_util::GetStringUTF8(
@@ -110,7 +110,7 @@ void FontsPageGtk::Init() {
void FontsPageGtk::InitDefaultEncodingComboBox() {
default_encoding_combobox_ = gtk_combo_box_new_text();
g_signal_connect(default_encoding_combobox_, "changed",
- G_CALLBACK(OnDefaultEncodingChangedThunk), this);
+ G_CALLBACK(OnDefaultEncodingChanged), this);
int canonical_encoding_names_length =
CharacterEncoding::GetSupportCanonicalEncodingCount();
// Initialize the vector of all sorted encodings according to current
@@ -161,10 +161,10 @@ void FontsPageGtk::NotifyPrefChanged(const std::wstring* pref_name) {
}
void FontsPageGtk::SetFontsFromButton(StringPrefMember* name_pref,
- IntegerPrefMember* size_pref,
- GtkWidget* font_button) {
+ IntegerPrefMember* size_pref,
+ GtkFontButton* font_button) {
PangoFontDescription* desc = pango_font_description_from_string(
- gtk_font_button_get_font_name(GTK_FONT_BUTTON(font_button)));
+ gtk_font_button_get_font_name(font_button));
int size = pango_font_description_get_size(desc);
name_pref->SetValue(UTF8ToWide(pango_font_description_get_family(desc)));
size_pref->SetValue(size / PANGO_SCALE);
@@ -175,32 +175,41 @@ void FontsPageGtk::SetFontsFromButton(StringPrefMember* name_pref,
NotifyPrefChanged(NULL);
}
-void FontsPageGtk::OnSerifFontSet(GtkWidget* font_button) {
- SetFontsFromButton(&serif_name_,
- &variable_width_size_,
- font_button);
+
+// static
+void FontsPageGtk::OnSerifFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page) {
+ fonts_page->SetFontsFromButton(&fonts_page->serif_name_,
+ &fonts_page->variable_width_size_,
+ font_button);
}
-void FontsPageGtk::OnSansFontSet(GtkWidget* font_button) {
- SetFontsFromButton(&sans_serif_name_,
- &variable_width_size_,
- font_button);
+// static
+void FontsPageGtk::OnSansFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page) {
+ fonts_page->SetFontsFromButton(&fonts_page->sans_serif_name_,
+ &fonts_page->variable_width_size_,
+ font_button);
}
-void FontsPageGtk::OnFixedFontSet(GtkWidget* font_button) {
- SetFontsFromButton(&fixed_width_name_,
- &fixed_width_size_,
- font_button);
+// static
+void FontsPageGtk::OnFixedFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page) {
+ fonts_page->SetFontsFromButton(&fonts_page->fixed_width_name_,
+ &fonts_page->fixed_width_size_,
+ font_button);
}
-void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) {
- int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box));
+// static
+void FontsPageGtk::OnDefaultEncodingChanged(GtkComboBox* combo_box,
+ FontsPageGtk* fonts_page) {
+ int index = gtk_combo_box_get_active(combo_box);
if (index < 0 ||
- static_cast<size_t>(index) >= sorted_encoding_list_.size()) {
+ static_cast<size_t>(index) >= fonts_page->sorted_encoding_list_.size()) {
NOTREACHED();
return;
}
- default_encoding_.SetValue(
+ fonts_page->default_encoding_.SetValue(
ASCIIToWide(CharacterEncoding::GetCanonicalEncodingNameByCommandId(
- sorted_encoding_list_[index].encoding_id)));
+ fonts_page->sorted_encoding_list_[index].encoding_id)));
}