From 9e2565ee1b21c0ae681c1ead5570a327cb59501e Mon Sep 17 00:00:00 2001 From: "estade@chromium.org" Date: Fri, 12 Mar 2010 19:28:50 +0000 Subject: Fix the rest of the gtk/options directory to use new callback macros. Problematically, the callback macros don't cover the case where the GObject* isn't a GtkWidget* D: BUG=None TEST=compile Review URL: http://codereview.chromium.org/857006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41458 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/options/fonts_page_gtk.cc | 63 ++++++++++++---------------- 1 file changed, 27 insertions(+), 36 deletions(-) (limited to 'chrome/browser/gtk/options/fonts_page_gtk.cc') diff --git a/chrome/browser/gtk/options/fonts_page_gtk.cc b/chrome/browser/gtk/options/fonts_page_gtk.cc index 941e252..9a8eafb 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(OnSerifFontSet), - this); + g_signal_connect(serif_font_button_, "font-set", + G_CALLBACK(OnSerifFontSetThunk), 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(OnSansFontSet), - this); + g_signal_connect(sans_font_button_, "font-set", + G_CALLBACK(OnSansFontSetThunk), 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(OnFixedFontSet), - this); + g_signal_connect(fixed_font_button_, "font-set", + G_CALLBACK(OnFixedFontSetThunk), 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(OnDefaultEncodingChanged), this); + G_CALLBACK(OnDefaultEncodingChangedThunk), 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, - GtkFontButton* font_button) { + IntegerPrefMember* size_pref, + GtkWidget* font_button) { PangoFontDescription* desc = pango_font_description_from_string( - gtk_font_button_get_font_name(font_button)); + gtk_font_button_get_font_name(GTK_FONT_BUTTON(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,41 +175,32 @@ void FontsPageGtk::SetFontsFromButton(StringPrefMember* name_pref, NotifyPrefChanged(NULL); } - -// 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::OnSerifFontSet(GtkWidget* font_button) { + SetFontsFromButton(&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::OnSansFontSet(GtkWidget* font_button) { + SetFontsFromButton(&sans_serif_name_, + &variable_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::OnFixedFontSet(GtkWidget* font_button) { + SetFontsFromButton(&fixed_width_name_, + &fixed_width_size_, + font_button); } -// static -void FontsPageGtk::OnDefaultEncodingChanged(GtkComboBox* combo_box, - FontsPageGtk* fonts_page) { - int index = gtk_combo_box_get_active(combo_box); +void FontsPageGtk::OnDefaultEncodingChanged(GtkWidget* combo_box) { + int index = gtk_combo_box_get_active(GTK_COMBO_BOX(combo_box)); if (index < 0 || - static_cast(index) >= fonts_page->sorted_encoding_list_.size()) { + static_cast(index) >= sorted_encoding_list_.size()) { NOTREACHED(); return; } - fonts_page->default_encoding_.SetValue( + default_encoding_.SetValue( ASCIIToWide(CharacterEncoding::GetCanonicalEncodingNameByCommandId( - fonts_page->sorted_encoding_list_[index].encoding_id))); + sorted_encoding_list_[index].encoding_id))); } -- cgit v1.1