summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 20:01:47 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-12 20:01:47 +0000
commit179484d80ce158dabeaebe11fcb4dd6ce5280487 (patch)
treecc97bc1fdafa2a342fff76813034afa1b7c45dbc /chrome
parent97d052416394e439380cb932dfaed867e9db650b (diff)
downloadchromium_src-179484d80ce158dabeaebe11fcb4dd6ce5280487.zip
chromium_src-179484d80ce158dabeaebe11fcb4dd6ce5280487.tar.gz
chromium_src-179484d80ce158dabeaebe11fcb4dd6ce5280487.tar.bz2
Revert: r41458 | estade@chromium.org | 2010-03-12 11:28:50 -0800 (Fri, 12 Mar 2010) | 8 lines
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 it's breaking unit tests Review URL: http://codereview.chromium.org/886005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41465 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.cc63
-rw-r--r--chrome/browser/gtk/options/fonts_page_gtk.h18
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.cc164
-rw-r--r--chrome/browser/gtk/options/general_page_gtk.h52
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.cc82
-rw-r--r--chrome/browser/gtk/options/languages_page_gtk.h26
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc43
-rw-r--r--chrome/browser/gtk/options/passwords_exceptions_page_gtk.h18
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.cc102
-rw-r--r--chrome/browser/gtk/options/passwords_page_gtk.h27
-rw-r--r--chrome/browser/gtk/options/url_picker_dialog_gtk.cc42
-rw-r--r--chrome/browser/gtk/options/url_picker_dialog_gtk.h22
12 files changed, 397 insertions, 262 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)));
}
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.h b/chrome/browser/gtk/options/fonts_page_gtk.h
index 92a44ad..31e3fd3 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.h
+++ b/chrome/browser/gtk/options/fonts_page_gtk.h
@@ -11,7 +11,6 @@
#include <gtk/gtk.h>
#include <vector>
-#include "app/gtk_signal.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/pref_member.h"
#include "chrome/browser/options_page_base.h"
@@ -37,12 +36,17 @@ class FontsPageGtk : public OptionsPageBase {
// GtkFontSelector returns the value in points not pixels.
void SetFontsFromButton(StringPrefMember* name_pref,
IntegerPrefMember* size_pref,
- GtkWidget* font_button);
-
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSerifFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnSansFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnFixedFontSet);
- CHROMEGTK_CALLBACK_0(FontsPageGtk, void, OnDefaultEncodingChanged);
+ GtkFontButton* font_button);
+
+ // Callbacks
+ static void OnSerifFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page);
+ static void OnSansFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page);
+ static void OnFixedFontSet(GtkFontButton* font_button,
+ FontsPageGtk* fonts_page);
+ static void OnDefaultEncodingChanged(GtkComboBox* combo_box,
+ FontsPageGtk* fonts_page);
// The font chooser widgets
GtkWidget* serif_font_button_;
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc
index 15db49f..8aecafe 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/gtk/options/general_page_gtk.cc
@@ -186,14 +186,14 @@ GtkWidget* GeneralPageGtk::InitStartupGroup() {
l10n_util::GetStringUTF8(
IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB).c_str());
g_signal_connect(startup_homepage_radio_, "toggled",
- G_CALLBACK(OnStartupRadioToggledThunk), this);
+ G_CALLBACK(OnStartupRadioToggled), this);
gtk_box_pack_start(GTK_BOX(vbox), startup_homepage_radio_, FALSE, FALSE, 0);
startup_last_session_radio_ = gtk_radio_button_new_with_label_from_widget(
GTK_RADIO_BUTTON(startup_homepage_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION).c_str());
g_signal_connect(startup_last_session_radio_, "toggled",
- G_CALLBACK(OnStartupRadioToggledThunk), this);
+ G_CALLBACK(OnStartupRadioToggled), this);
gtk_box_pack_start(GTK_BOX(vbox), startup_last_session_radio_,
FALSE, FALSE, 0);
@@ -201,7 +201,7 @@ GtkWidget* GeneralPageGtk::InitStartupGroup() {
GTK_RADIO_BUTTON(startup_homepage_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_STARTUP_SHOW_PAGES).c_str());
g_signal_connect(startup_custom_radio_, "toggled",
- G_CALLBACK(OnStartupRadioToggledThunk), this);
+ G_CALLBACK(OnStartupRadioToggled), this);
gtk_box_pack_start(GTK_BOX(vbox), startup_custom_radio_, FALSE, FALSE, 0);
GtkWidget* url_list_container = gtk_hbox_new(FALSE,
@@ -259,21 +259,21 @@ GtkWidget* GeneralPageGtk::InitStartupGroup() {
gtk_util::ConvertAcceleratorsFromWindowsStyle(
l10n_util::GetStringUTF8(IDS_OPTIONS_STARTUP_ADD_BUTTON)).c_str());
g_signal_connect(startup_add_custom_page_button_, "clicked",
- G_CALLBACK(OnStartupAddCustomPageClickedThunk), this);
+ G_CALLBACK(OnStartupAddCustomPageClicked), this);
gtk_box_pack_start(GTK_BOX(url_list_buttons), startup_add_custom_page_button_,
FALSE, FALSE, 0);
startup_remove_custom_page_button_ = gtk_button_new_with_mnemonic(
gtk_util::ConvertAcceleratorsFromWindowsStyle(
l10n_util::GetStringUTF8(IDS_OPTIONS_STARTUP_REMOVE_BUTTON)).c_str());
g_signal_connect(startup_remove_custom_page_button_, "clicked",
- G_CALLBACK(OnStartupRemoveCustomPageClickedThunk), this);
+ G_CALLBACK(OnStartupRemoveCustomPageClicked), this);
gtk_box_pack_start(GTK_BOX(url_list_buttons),
startup_remove_custom_page_button_, FALSE, FALSE, 0);
startup_use_current_page_button_ = gtk_button_new_with_mnemonic(
gtk_util::ConvertAcceleratorsFromWindowsStyle(
l10n_util::GetStringUTF8(IDS_OPTIONS_STARTUP_USE_CURRENT)).c_str());
g_signal_connect(startup_use_current_page_button_, "clicked",
- G_CALLBACK(OnStartupUseCurrentPageClickedThunk), this);
+ G_CALLBACK(OnStartupUseCurrentPageClicked), this);
gtk_box_pack_start(GTK_BOX(url_list_buttons),
startup_use_current_page_button_, FALSE, FALSE, 0);
@@ -286,7 +286,7 @@ GtkWidget* GeneralPageGtk::InitHomepageGroup() {
homepage_use_newtab_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB).c_str());
g_signal_connect(homepage_use_newtab_radio_, "toggled",
- G_CALLBACK(OnNewTabIsHomePageToggledThunk), this);
+ G_CALLBACK(OnNewTabIsHomePageToggled), this);
gtk_container_add(GTK_CONTAINER(vbox), homepage_use_newtab_radio_);
GtkWidget* homepage_hbox = gtk_hbox_new(FALSE, gtk_util::kLabelSpacing);
@@ -296,20 +296,20 @@ GtkWidget* GeneralPageGtk::InitHomepageGroup() {
GTK_RADIO_BUTTON(homepage_use_newtab_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_HOMEPAGE_USE_URL).c_str());
g_signal_connect(homepage_use_url_radio_, "toggled",
- G_CALLBACK(OnNewTabIsHomePageToggledThunk), this);
+ G_CALLBACK(OnNewTabIsHomePageToggled), this);
gtk_box_pack_start(GTK_BOX(homepage_hbox), homepage_use_url_radio_,
FALSE, FALSE, 0);
homepage_use_url_entry_ = gtk_entry_new();
g_signal_connect(homepage_use_url_entry_, "changed",
- G_CALLBACK(OnHomepageUseUrlEntryChangedThunk), this);
+ G_CALLBACK(OnHomepageUseUrlEntryChanged), this);
gtk_box_pack_start(GTK_BOX(homepage_hbox), homepage_use_url_entry_,
TRUE, TRUE, 0);
homepage_show_home_button_checkbox_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON).c_str());
g_signal_connect(homepage_show_home_button_checkbox_, "toggled",
- G_CALLBACK(OnShowHomeButtonToggledThunk), this);
+ G_CALLBACK(OnShowHomeButtonToggled), this);
gtk_container_add(GTK_CONTAINER(vbox), homepage_show_home_button_checkbox_);
return vbox;
@@ -325,7 +325,7 @@ GtkWidget* GeneralPageGtk::InitDefaultSearchGroup() {
GTK_TREE_MODEL(default_search_engines_model_));
g_object_unref(default_search_engines_model_);
g_signal_connect(default_search_engine_combobox_, "changed",
- G_CALLBACK(OnDefaultSearchEngineChangedThunk), this);
+ G_CALLBACK(OnDefaultSearchEngineChanged), this);
gtk_container_add(GTK_CONTAINER(hbox), default_search_engine_combobox_);
accessible_widget_helper_->SetWidgetName(
default_search_engine_combobox_, IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME);
@@ -349,7 +349,7 @@ GtkWidget* GeneralPageGtk::InitDefaultSearchGroup() {
l10n_util::GetStringUTF8(
IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK).c_str());
g_signal_connect(default_search_manage_engines_button_, "clicked",
- G_CALLBACK(OnDefaultSearchManageEnginesClickedThunk), this);
+ G_CALLBACK(OnDefaultSearchManageEnginesClicked), this);
gtk_box_pack_end(GTK_BOX(hbox), default_search_manage_engines_button_,
FALSE, FALSE, 0);
@@ -369,7 +369,7 @@ GtkWidget* GeneralPageGtk::InitDefaultBrowserGroup() {
l10n_util::GetStringFUTF8(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT,
l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)).c_str());
g_signal_connect(default_browser_use_as_default_button_, "clicked",
- G_CALLBACK(OnBrowserUseAsDefaultClickedThunk), this);
+ G_CALLBACK(OnBrowserUseAsDefaultClicked), this);
gtk_box_pack_start(GTK_BOX(vbox), default_browser_use_as_default_button_,
FALSE, FALSE, 0);
@@ -382,107 +382,133 @@ GtkWidget* GeneralPageGtk::InitDefaultBrowserGroup() {
return vbox_alignment;
}
-void GeneralPageGtk::OnStartupRadioToggled(GtkWidget* toggle_button) {
- if (initializing_)
+// static
+void GeneralPageGtk::OnStartupRadioToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page) {
+ if (general_page->initializing_)
return;
- if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button))) {
+ if (!gtk_toggle_button_get_active(toggle_button)) {
// When selecting a radio button, we get two signals (one for the old radio
// being toggled off, one for the new one being toggled on.) Ignore the
// signal for toggling off the old button.
return;
}
- SaveStartupPref();
- if (toggle_button == startup_homepage_radio_) {
- UserMetricsRecordAction("Options_Startup_Homepage",
- profile()->GetPrefs());
- } else if (toggle_button == startup_last_session_radio_) {
- UserMetricsRecordAction("Options_Startup_LastSession",
- profile()->GetPrefs());
- } else if (toggle_button == startup_custom_radio_) {
- UserMetricsRecordAction("Options_Startup_Custom",
- profile()->GetPrefs());
+ general_page->SaveStartupPref();
+ GtkWidget* sender = GTK_WIDGET(toggle_button);
+ if (sender == general_page->startup_homepage_radio_) {
+ general_page->UserMetricsRecordAction("Options_Startup_Homepage",
+ general_page->profile()->GetPrefs());
+ } else if (sender == general_page->startup_last_session_radio_) {
+ general_page->UserMetricsRecordAction("Options_Startup_LastSession",
+ general_page->profile()->GetPrefs());
+ } else if (sender == general_page->startup_custom_radio_) {
+ general_page->UserMetricsRecordAction("Options_Startup_Custom",
+ general_page->profile()->GetPrefs());
}
}
-void GeneralPageGtk::OnStartupAddCustomPageClicked(GtkWidget* button) {
+// static
+void GeneralPageGtk::OnStartupAddCustomPageClicked(
+ GtkButton* button, GeneralPageGtk* general_page) {
new UrlPickerDialogGtk(
- NewCallback(this, &GeneralPageGtk::OnAddCustomUrl),
- profile(),
- GTK_WINDOW(gtk_widget_get_toplevel(page_)));
+ NewCallback(general_page, &GeneralPageGtk::OnAddCustomUrl),
+ general_page->profile(),
+ GTK_WINDOW(gtk_widget_get_toplevel(general_page->page_)));
}
-void GeneralPageGtk::OnStartupRemoveCustomPageClicked(GtkWidget* button) {
- RemoveSelectedCustomUrls();
+// static
+void GeneralPageGtk::OnStartupRemoveCustomPageClicked(
+ GtkButton* button, GeneralPageGtk* general_page) {
+ general_page->RemoveSelectedCustomUrls();
}
-void GeneralPageGtk::OnStartupUseCurrentPageClicked(GtkWidget* button) {
- SetCustomUrlListFromCurrentPages();
+// static
+void GeneralPageGtk::OnStartupUseCurrentPageClicked(
+ GtkButton* button, GeneralPageGtk* general_page) {
+ general_page->SetCustomUrlListFromCurrentPages();
}
// static
void GeneralPageGtk::OnStartupPagesSelectionChanged(
- GtkTreeSelection* selection, GeneralPageGtk* general_page) {
+ GtkTreeSelection *selection, GeneralPageGtk* general_page) {
general_page->EnableCustomHomepagesControls(true);
}
-void GeneralPageGtk::OnNewTabIsHomePageToggled(GtkWidget* toggle_button) {
- if (initializing_)
+// static
+void GeneralPageGtk::OnNewTabIsHomePageToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page) {
+ if (general_page->initializing_)
return;
- if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button))) {
+ if (!gtk_toggle_button_get_active(toggle_button)) {
// Ignore the signal for toggling off the old button.
return;
}
- if (toggle_button == homepage_use_newtab_radio_) {
- SetHomepage(GURL());
- UserMetricsRecordAction("Options_Homepage_UseNewTab",
- profile()->GetPrefs());
- gtk_widget_set_sensitive(homepage_use_url_entry_, FALSE);
- } else if (toggle_button == homepage_use_url_radio_) {
- SetHomepageFromEntry();
- UserMetricsRecordAction("Options_Homepage_UseURL",
- profile()->GetPrefs());
- gtk_widget_set_sensitive(homepage_use_url_entry_, TRUE);
+ GtkWidget* sender = GTK_WIDGET(toggle_button);
+ if (sender == general_page->homepage_use_newtab_radio_) {
+ general_page->SetHomepage(GURL());
+ general_page->UserMetricsRecordAction("Options_Homepage_UseNewTab",
+ general_page->profile()->GetPrefs());
+ gtk_widget_set_sensitive(general_page->homepage_use_url_entry_, FALSE);
+ } else if (sender == general_page->homepage_use_url_radio_) {
+ general_page->SetHomepageFromEntry();
+ general_page->UserMetricsRecordAction("Options_Homepage_UseURL",
+ general_page->profile()->GetPrefs());
+ gtk_widget_set_sensitive(general_page->homepage_use_url_entry_, TRUE);
}
}
-void GeneralPageGtk::OnHomepageUseUrlEntryChanged(GtkWidget* editable) {
- if (initializing_)
+// static
+void GeneralPageGtk::OnHomepageUseUrlEntryChanged(
+ GtkEditable* editable,
+ GeneralPageGtk* general_page) {
+ if (general_page->initializing_)
return;
- SetHomepageFromEntry();
+ general_page->SetHomepageFromEntry();
}
-void GeneralPageGtk::OnShowHomeButtonToggled(GtkWidget* toggle_button) {
- if (initializing_)
+// static
+void GeneralPageGtk::OnShowHomeButtonToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page) {
+ if (general_page->initializing_)
return;
- bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button));
- show_home_button_.SetValue(enabled);
+ bool enabled = gtk_toggle_button_get_active(toggle_button);
+ general_page->show_home_button_.SetValue(enabled);
if (enabled) {
- UserMetricsRecordAction("Options_Homepage_ShowHomeButton",
- profile()->GetPrefs());
+ general_page->UserMetricsRecordAction("Options_Homepage_ShowHomeButton",
+ general_page->profile()->GetPrefs());
} else {
- UserMetricsRecordAction("Options_Homepage_HideHomeButton",
- profile()->GetPrefs());
+ general_page->UserMetricsRecordAction("Options_Homepage_HideHomeButton",
+ general_page->profile()->GetPrefs());
}
}
-void GeneralPageGtk::OnDefaultSearchEngineChanged(GtkWidget* combo_box) {
- if (default_search_initializing_)
+// static
+void GeneralPageGtk::OnDefaultSearchEngineChanged(
+ GtkComboBox* combo_box,
+ GeneralPageGtk* general_page) {
+ if (general_page->default_search_initializing_)
return;
- SetDefaultSearchEngineFromComboBox();
+ general_page->SetDefaultSearchEngineFromComboBox();
}
-void GeneralPageGtk::OnDefaultSearchManageEnginesClicked(GtkWidget* button) {
- KeywordEditorView::Show(profile());
+// static
+void GeneralPageGtk::OnDefaultSearchManageEnginesClicked(
+ GtkButton* button, GeneralPageGtk* general_page) {
+ KeywordEditorView::Show(general_page->profile());
}
-void GeneralPageGtk::OnBrowserUseAsDefaultClicked(GtkWidget* button) {
- default_browser_worker_->StartSetAsDefaultBrowser();
+// static
+void GeneralPageGtk::OnBrowserUseAsDefaultClicked(
+ GtkButton* button,
+ GeneralPageGtk* general_page) {
+ general_page->default_browser_worker_->StartSetAsDefaultBrowser();
// If the user made Chrome the default browser, then he/she arguably wants
// to be notified when that changes.
- profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, true);
- UserMetricsRecordAction("Options_SetAsDefaultBrowser",
- profile()->GetPrefs());
+ general_page->profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser,
+ true);
+ general_page->UserMetricsRecordAction("Options_SetAsDefaultBrowser",
+ general_page->profile()->GetPrefs());
}
void GeneralPageGtk::SaveStartupPref() {
diff --git a/chrome/browser/gtk/options/general_page_gtk.h b/chrome/browser/gtk/options/general_page_gtk.h
index b1f767c..fcb87b2 100644
--- a/chrome/browser/gtk/options/general_page_gtk.h
+++ b/chrome/browser/gtk/options/general_page_gtk.h
@@ -10,7 +10,6 @@
#include <string>
#include <vector>
-#include "app/gtk_signal.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/options_page_base.h"
#include "chrome/browser/pref_member.h"
@@ -86,21 +85,46 @@ class GeneralPageGtk : public OptionsPageBase,
// Sets the home page pref using the value in the entry box
void SetHomepageFromEntry();
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRadioToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupAddCustomPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupRemoveCustomPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnStartupUseCurrentPageClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnNewTabIsHomePageToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnHomepageUseUrlEntryChanged);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnShowHomeButtonToggled);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnDefaultSearchEngineChanged);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void,
- OnDefaultSearchManageEnginesClicked);
- CHROMEGTK_CALLBACK_0(GeneralPageGtk, void, OnBrowserUseAsDefaultClicked);
-
- static void OnStartupPagesSelectionChanged(GtkTreeSelection* selection,
+ // Callback for startup radio buttons
+ static void OnStartupRadioToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page);
+
+ // Callbacks for custom url list buttons
+ static void OnStartupAddCustomPageClicked(GtkButton* button,
+ GeneralPageGtk* general_page);
+ static void OnStartupRemoveCustomPageClicked(GtkButton* button,
+ GeneralPageGtk* general_page);
+ static void OnStartupUseCurrentPageClicked(GtkButton* button,
+ GeneralPageGtk* general_page);
+
+ // Callback for user selecting rows in custom pages list
+ static void OnStartupPagesSelectionChanged(GtkTreeSelection *selection,
GeneralPageGtk* general_page);
+ // Callback for new tab behavior radio buttons
+ static void OnNewTabIsHomePageToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page);
+
+ // Callback for homepage URL entry
+ static void OnHomepageUseUrlEntryChanged(GtkEditable* editable,
+ GeneralPageGtk* general_page);
+
+ // Callback for Show Home Button option
+ static void OnShowHomeButtonToggled(GtkToggleButton* toggle_button,
+ GeneralPageGtk* general_page);
+
+ // Callback for default search engine selection
+ static void OnDefaultSearchEngineChanged(GtkComboBox* combo_box,
+ GeneralPageGtk* general_page);
+
+ // Callback for manage search engines button
+ static void OnDefaultSearchManageEnginesClicked(GtkButton* button,
+ GeneralPageGtk* general_page);
+
+ // Callback for use as default browser button
+ static void OnBrowserUseAsDefaultClicked(GtkButton* button,
+ GeneralPageGtk* general_page);
+
// Enables/Disables the controls associated with the custom start pages
// option if that preference is not selected.
void EnableCustomHomepagesControls(bool enable);
diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc
index f948ea0..a94a209 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.cc
+++ b/chrome/browser/gtk/options/languages_page_gtk.cc
@@ -196,7 +196,7 @@ void LanguagesPageGtk::Init() {
add_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_ADD_BUTTON_LABEL).c_str());
g_signal_connect(add_button_, "clicked",
- G_CALLBACK(OnAddButtonClickedThunk), this);
+ G_CALLBACK(OnAddButtonClicked), this);
gtk_box_pack_start(GTK_BOX(languages_buttons_vbox), add_button_,
FALSE, FALSE, 0);
@@ -204,7 +204,7 @@ void LanguagesPageGtk::Init() {
IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_REMOVE_BUTTON_LABEL);
remove_button_ = gtk_button_new_with_label(remove_button_text.c_str());
g_signal_connect(remove_button_, "clicked",
- G_CALLBACK(OnRemoveButtonClickedThunk), this);
+ G_CALLBACK(OnRemoveButtonClicked), this);
gtk_box_pack_start(GTK_BOX(languages_buttons_vbox), remove_button_,
FALSE, FALSE, 0);
@@ -212,7 +212,7 @@ void LanguagesPageGtk::Init() {
IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEUP_BUTTON_LABEL);
move_up_button_ = gtk_button_new_with_label(move_up_button_text.c_str());
g_signal_connect(move_up_button_, "clicked",
- G_CALLBACK(OnMoveUpButtonClickedThunk), this);
+ G_CALLBACK(OnMoveUpButtonClicked), this);
gtk_box_pack_start(GTK_BOX(languages_buttons_vbox), move_up_button_,
FALSE, FALSE, 0);
@@ -220,7 +220,7 @@ void LanguagesPageGtk::Init() {
IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEDOWN_BUTTON_LABEL);
move_down_button_ = gtk_button_new_with_label(move_down_button_text.c_str());
g_signal_connect(move_down_button_, "clicked",
- G_CALLBACK(OnMoveDownButtonClickedThunk), this);
+ G_CALLBACK(OnMoveDownButtonClicked), this);
gtk_box_pack_start(GTK_BOX(languages_buttons_vbox), move_down_button_,
FALSE, FALSE, 0);
@@ -232,7 +232,7 @@ void LanguagesPageGtk::Init() {
enable_spellchecking_checkbox_ = gtk_check_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_ENABLE_SPELLCHECK).c_str());
g_signal_connect(enable_spellchecking_checkbox_, "toggled",
- G_CALLBACK(OnEnableSpellCheckingToggledThunk), this);
+ G_CALLBACK(OnEnableSpellCheckingToggled), this);
gtk_box_pack_start(GTK_BOX(spellchecker_vbox), enable_spellchecking_checkbox_,
FALSE, FALSE, 0);
@@ -242,7 +242,7 @@ void LanguagesPageGtk::Init() {
l10n_util::GetStringUTF8(
IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION).c_str());
g_signal_connect(enable_autospellcorrect_checkbox_, "toggled",
- G_CALLBACK(OnEnableAutoSpellCheckingToggledThunk), this);
+ G_CALLBACK(OnEnableAutoSpellCheckingToggled), this);
gtk_box_pack_start(GTK_BOX(spellchecker_vbox),
enable_autospellcorrect_checkbox_, FALSE, FALSE, 0);
}
@@ -367,60 +367,82 @@ void LanguagesPageGtk::OnSelectionChanged(GtkTreeSelection *selection,
languages_page->EnableControls();
}
-void LanguagesPageGtk::OnAddButtonClicked(GtkWidget* button) {
- new AddLanguageDialog(profile(), this);
+// static
+void LanguagesPageGtk::OnAddButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page) {
+ new AddLanguageDialog(languages_page->profile(), languages_page);
}
-void LanguagesPageGtk::OnRemoveButtonClicked(GtkWidget* button) {
+// static
+void LanguagesPageGtk::OnRemoveButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page) {
std::set<int> selected_rows;
- gtk_tree::GetSelectedIndicies(language_order_selection_,
+ gtk_tree::GetSelectedIndicies(languages_page->language_order_selection_,
&selected_rows);
int selected_row = 0;
for (std::set<int>::reverse_iterator selected = selected_rows.rbegin();
selected != selected_rows.rend(); ++selected) {
- language_order_table_model_->Remove(*selected);
+ languages_page->language_order_table_model_->Remove(*selected);
selected_row = *selected;
}
- int row_count = language_order_table_model_->RowCount();
+ int row_count = languages_page->language_order_table_model_->RowCount();
if (row_count <= 0)
return;
if (selected_row >= row_count)
selected_row = row_count - 1;
gtk_tree::SelectAndFocusRowNum(selected_row,
- GTK_TREE_VIEW(language_order_tree_));
+ GTK_TREE_VIEW(languages_page->language_order_tree_));
}
-void LanguagesPageGtk::OnMoveUpButtonClicked(GtkWidget* button) {
- int item_selected = FirstSelectedRowNum();
- language_order_table_model_->MoveUp(item_selected);
+// static
+void LanguagesPageGtk::OnMoveUpButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page) {
+ int item_selected = languages_page->FirstSelectedRowNum();
+ languages_page->language_order_table_model_->MoveUp(item_selected);
gtk_tree::SelectAndFocusRowNum(
- item_selected - 1, GTK_TREE_VIEW(language_order_tree_));
+ item_selected - 1, GTK_TREE_VIEW(languages_page->language_order_tree_));
}
-void LanguagesPageGtk::OnMoveDownButtonClicked(GtkWidget* button) {
- int item_selected = FirstSelectedRowNum();
- language_order_table_model_->MoveDown(item_selected);
+// static
+void LanguagesPageGtk::OnMoveDownButtonClicked(
+ GtkButton* button, LanguagesPageGtk* languages_page) {
+ int item_selected = languages_page->FirstSelectedRowNum();
+ languages_page->language_order_table_model_->MoveDown(item_selected);
gtk_tree::SelectAndFocusRowNum(
- item_selected + 1, GTK_TREE_VIEW(language_order_tree_));
+ item_selected + 1, GTK_TREE_VIEW(languages_page->language_order_tree_));
}
-void LanguagesPageGtk::OnEnableSpellCheckingToggled(GtkWidget* toggle_button) {
- if (initializing_)
+// static
+void LanguagesPageGtk::OnEnableSpellCheckingToggled(
+ GtkToggleButton* toggle_button,
+ LanguagesPageGtk* languages_page) {
+ if (languages_page->initializing_)
return;
- enable_spellcheck_.SetValue(
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
+ languages_page->enable_spellcheck_.SetValue(
+ gtk_toggle_button_get_active(toggle_button));
}
+// static
void LanguagesPageGtk::OnEnableAutoSpellCheckingToggled(
- GtkWidget* toggle_button) {
- if (initializing_)
+ GtkToggleButton* toggle_button,
+ LanguagesPageGtk* languages_page) {
+ if (languages_page->initializing_)
+ return;
+ languages_page->enable_autospellcorrect_.SetValue(
+ gtk_toggle_button_get_active(toggle_button));
+}
+
+// static
+void LanguagesPageGtk::OnDictionaryLanguageChangedThunk(
+ GtkComboBox* combo_box,
+ LanguagesPageGtk* languages_page) {
+ if (languages_page->initializing_)
return;
- enable_autospellcorrect_.SetValue(
- gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
+ languages_page->OnDictionaryLanguageChanged();
}
-void LanguagesPageGtk::OnDictionaryLanguageChanged(GtkWidget* widget) {
+void LanguagesPageGtk::OnDictionaryLanguageChanged() {
int new_index = gtk_combo_box_get_active(
GTK_COMBO_BOX(dictionary_language_combobox_));
diff --git a/chrome/browser/gtk/options/languages_page_gtk.h b/chrome/browser/gtk/options/languages_page_gtk.h
index b7140ae..dc44006 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.h
+++ b/chrome/browser/gtk/options/languages_page_gtk.h
@@ -16,7 +16,6 @@
#include <string>
-#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/gtk_tree.h"
#include "chrome/browser/pref_member.h"
@@ -63,18 +62,25 @@ class LanguagesPageGtk
virtual void NotifyPrefChanged(const std::wstring* pref_name);
// Callbacks for accept languages widgets.
- static void OnSelectionChanged(GtkTreeSelection* selection,
+ static void OnSelectionChanged(GtkTreeSelection *selection,
LanguagesPageGtk* languages_page);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnAddButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveUpButtonClicked);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveDownButtonClicked);
+ static void OnAddButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page);
+ static void OnRemoveButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page);
+ static void OnMoveUpButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page);
+ static void OnMoveDownButtonClicked(GtkButton* button,
+ LanguagesPageGtk* languages_page);
// Callbacks for spellchecker option widgets.
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnEnableSpellCheckingToggled);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void,
- OnEnableAutoSpellCheckingToggled);
- CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnDictionaryLanguageChanged);
+ static void OnEnableSpellCheckingToggled(GtkToggleButton* toggle_button,
+ LanguagesPageGtk* languages_page);
+ static void OnEnableAutoSpellCheckingToggled(
+ GtkToggleButton* toggle_button, LanguagesPageGtk* languages_page);
+ static void OnDictionaryLanguageChangedThunk(
+ GtkComboBox* combo_box, LanguagesPageGtk* languages_page);
+ void OnDictionaryLanguageChanged();
// The accept languages widgets.
GtkListStore* language_order_store_;
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
index 47a203c..1bd4c7b 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
@@ -40,12 +40,12 @@ PasswordsExceptionsPageGtk::PasswordsExceptionsPageGtk(Profile* profile)
l10n_util::GetStringUTF8(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_BUTTON).c_str());
gtk_widget_set_sensitive(remove_button_, FALSE);
g_signal_connect(remove_button_, "clicked",
- G_CALLBACK(OnRemoveButtonClickedThunk), this);
+ G_CALLBACK(OnRemoveButtonClicked), this);
remove_all_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON).c_str());
gtk_widget_set_sensitive(remove_all_button_, FALSE);
g_signal_connect(remove_all_button_, "clicked",
- G_CALLBACK(OnRemoveAllButtonClickedThunk), this);
+ G_CALLBACK(OnRemoveAllButtonClicked), this);
GtkWidget* buttons = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
gtk_box_pack_start(GTK_BOX(buttons), remove_button_, FALSE, FALSE, 0);
@@ -125,41 +125,48 @@ void PasswordsExceptionsPageGtk::SetExceptionList(
gtk_widget_set_sensitive(remove_all_button_, result.size() > 0);
}
-void PasswordsExceptionsPageGtk::OnRemoveButtonClicked(GtkWidget* widget) {
+// static
+void PasswordsExceptionsPageGtk::OnRemoveButtonClicked(
+ GtkButton* widget,
+ PasswordsExceptionsPageGtk* page) {
GtkTreeIter iter;
- if (!gtk_tree_selection_get_selected(exception_selection_,
+ if (!gtk_tree_selection_get_selected(page->exception_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(exception_list_sort_), &iter);
+ GTK_TREE_MODEL(page->exception_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- exception_list_sort_, path);
+ page->exception_list_sort_, path);
gtk_tree_path_free(path);
GtkTreeIter child_iter;
gtk_tree_model_sort_convert_iter_to_child_iter(
- GTK_TREE_MODEL_SORT(exception_list_sort_), &child_iter, &iter);
+ GTK_TREE_MODEL_SORT(page->exception_list_sort_), &child_iter, &iter);
// Remove from GTK list, DB, and vector.
- gtk_list_store_remove(exception_list_store_, &child_iter);
- GetPasswordStore()->RemoveLogin(exception_list_[index]);
- exception_list_.erase(exception_list_.begin() + index);
+ gtk_list_store_remove(page->exception_list_store_, &child_iter);
+ page->GetPasswordStore()->RemoveLogin(page->exception_list_[index]);
+ page->exception_list_.erase(page->exception_list_.begin() + index);
- gtk_widget_set_sensitive(remove_all_button_, exception_list_.size() > 0);
+ gtk_widget_set_sensitive(page->remove_all_button_,
+ page->exception_list_.size() > 0);
}
-void PasswordsExceptionsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
+// static
+void PasswordsExceptionsPageGtk::OnRemoveAllButtonClicked(
+ GtkButton* widget,
+ PasswordsExceptionsPageGtk* page) {
// Remove from GTK list, DB, and vector.
- PasswordStore* store = GetPasswordStore();
- gtk_list_store_clear(exception_list_store_);
- for (size_t i = 0; i < exception_list_.size(); ++i) {
- store->RemoveLogin(exception_list_[i]);
+ PasswordStore* store = page->GetPasswordStore();
+ gtk_list_store_clear(page->exception_list_store_);
+ for (size_t i = 0; i < page->exception_list_.size(); ++i) {
+ store->RemoveLogin(page->exception_list_[i]);
}
- exception_list_.clear();
- gtk_widget_set_sensitive(remove_all_button_, FALSE);
+ page->exception_list_.clear();
+ gtk_widget_set_sensitive(page->remove_all_button_, FALSE);
}
// static
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
index 0fd350a..b226f0f 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
@@ -9,7 +9,6 @@
#include <vector>
-#include "app/gtk_signal.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/profile.h"
@@ -35,13 +34,17 @@ class PasswordsExceptionsPageGtk {
// Sets the exception list contents to the given data.
void SetExceptionList(const std::vector<webkit_glue::PasswordForm*>& result);
- CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void,
- OnRemoveAllButtonClicked);
+ // Callback for the remove button.
+ static void OnRemoveButtonClicked(GtkButton* widget,
+ PasswordsExceptionsPageGtk* page);
- static void OnExceptionSelectionChanged(
- GtkTreeSelection* selection,
- PasswordsExceptionsPageGtk* page);
+ // Callback for the remove all button.
+ static void OnRemoveAllButtonClicked(GtkButton* widget,
+ PasswordsExceptionsPageGtk* page);
+
+ // Callback for selection changed events.
+ static void OnExceptionSelectionChanged(GtkTreeSelection* selection,
+ PasswordsExceptionsPageGtk* page);
// Sorting function.
static gint CompareSite(GtkTreeModel* model,
@@ -60,7 +63,6 @@ class PasswordsExceptionsPageGtk {
// PasswordsExceptionsPageGtk.
void populate();
- // PasswordStoreConsumer implementation.
// Send the password store's reply back to the PasswordsExceptionsPageGtk.
virtual void OnPasswordStoreRequestDone(
int handle, const std::vector<webkit_glue::PasswordForm*>& result);
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.cc b/chrome/browser/gtk/options/passwords_page_gtk.cc
index a4e06de..5d21276 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_page_gtk.cc
@@ -45,12 +45,12 @@ PasswordsPageGtk::PasswordsPageGtk(Profile* profile)
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON).c_str());
gtk_widget_set_sensitive(remove_button_, FALSE);
g_signal_connect(remove_button_, "clicked",
- G_CALLBACK(OnRemoveButtonClickedThunk), this);
+ G_CALLBACK(OnRemoveButtonClicked), this);
remove_all_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON).c_str());
gtk_widget_set_sensitive(remove_all_button_, FALSE);
g_signal_connect(remove_all_button_, "clicked",
- G_CALLBACK(OnRemoveAllButtonClickedThunk), this);
+ G_CALLBACK(OnRemoveAllButtonClicked), this);
show_password_button_ = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON).c_str());
@@ -71,7 +71,7 @@ PasswordsPageGtk::PasswordsPageGtk(Profile* profile)
show_size.height);
gtk_widget_set_sensitive(show_password_button_, FALSE);
g_signal_connect(show_password_button_, "clicked",
- G_CALLBACK(OnShowPasswordButtonClickedThunk), this);
+ G_CALLBACK(OnShowPasswordButtonClicked), this);
password_ = gtk_label_new("");
@@ -124,7 +124,7 @@ void PasswordsPageGtk::InitPasswordTree() {
gtk_tree_selection_set_mode(password_selection_,
GTK_SELECTION_SINGLE);
g_signal_connect(password_selection_, "changed",
- G_CALLBACK(OnPasswordSelectionChangedThunk), this);
+ G_CALLBACK(OnPasswordSelectionChanged), this);
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN).c_str(),
@@ -171,35 +171,39 @@ void PasswordsPageGtk::SetPasswordList(
gtk_widget_set_sensitive(remove_all_button_, result.size() > 0);
}
-void PasswordsPageGtk::OnRemoveButtonClicked(GtkWidget* widget) {
+// static
+void PasswordsPageGtk::OnRemoveButtonClicked(GtkButton* widget,
+ PasswordsPageGtk* page) {
GtkTreeIter iter;
- if (!gtk_tree_selection_get_selected(password_selection_,
+ if (!gtk_tree_selection_get_selected(page->password_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(password_list_sort_), &iter);
+ GTK_TREE_MODEL(page->password_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- password_list_sort_, path);
+ page->password_list_sort_, path);
gtk_tree_path_free(path);
GtkTreeIter child_iter;
gtk_tree_model_sort_convert_iter_to_child_iter(
- GTK_TREE_MODEL_SORT(password_list_sort_), &child_iter, &iter);
+ GTK_TREE_MODEL_SORT(page->password_list_sort_), &child_iter, &iter);
// Remove from GTK list, DB, and vector.
- gtk_list_store_remove(password_list_store_, &child_iter);
- GetPasswordStore()->RemoveLogin(password_list_[index]);
- password_list_.erase(password_list_.begin() + index);
+ gtk_list_store_remove(page->password_list_store_, &child_iter);
+ page->GetPasswordStore()->RemoveLogin(page->password_list_[index]);
+ page->password_list_.erase(page->password_list_.begin() + index);
- gtk_widget_set_sensitive(remove_all_button_,
- password_list_.size() > 0);
+ gtk_widget_set_sensitive(page->remove_all_button_,
+ page->password_list_.size() > 0);
}
-void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
- GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page_));
+// static
+void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkButton* widget,
+ PasswordsPageGtk* page) {
+ GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page->page_));
GtkWidget* confirm = gtk_message_dialog_new(
window,
static_cast<GtkDialogFlags>(
@@ -212,13 +216,15 @@ void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
gtk_util::ApplyMessageDialogQuirks(confirm);
gtk_window_set_title(GTK_WINDOW(confirm), l10n_util::GetStringUTF8(
IDS_PASSWORDS_PAGE_VIEW_CAPTION_DELETE_ALL_PASSWORDS).c_str());
- g_signal_connect(confirm, "response",
- G_CALLBACK(OnRemoveAllConfirmResponseThunk), this);
+ g_signal_connect(confirm, "response", G_CALLBACK(OnRemoveAllConfirmResponse),
+ page);
gtk_widget_show_all(confirm);
}
-void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkWidget* confirm,
- gint response) {
+// static
+void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkDialog* confirm,
+ gint response,
+ PasswordsPageGtk* page) {
bool confirmed = false;
switch (response) {
case GTK_RESPONSE_YES:
@@ -227,62 +233,66 @@ void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkWidget* confirm,
default:
break;
}
- gtk_widget_destroy(confirm);
+ gtk_widget_destroy(GTK_WIDGET(confirm));
if (!confirmed)
return;
// Remove from GTK list, DB, and vector.
- PasswordStore* store = GetPasswordStore();
- gtk_list_store_clear(password_list_store_);
- for (size_t i = 0; i < password_list_.size(); ++i) {
- store->RemoveLogin(password_list_[i]);
+ PasswordStore* store = page->GetPasswordStore();
+ gtk_list_store_clear(page->password_list_store_);
+ for (size_t i = 0; i < page->password_list_.size(); ++i) {
+ store->RemoveLogin(page->password_list_[i]);
}
- password_list_.clear();
- gtk_widget_set_sensitive(remove_all_button_, FALSE);
+ page->password_list_.clear();
+ gtk_widget_set_sensitive(page->remove_all_button_, FALSE);
}
-void PasswordsPageGtk::OnShowPasswordButtonClicked(GtkWidget* widget) {
- password_showing_ = !password_showing_;
- if (!password_showing_) {
+// static
+void PasswordsPageGtk::OnShowPasswordButtonClicked(GtkButton* widget,
+ PasswordsPageGtk* page) {
+ page->password_showing_ = !page->password_showing_;
+ if (!page->password_showing_) {
// Hide the password.
- gtk_label_set_text(GTK_LABEL(password_), "");
- gtk_button_set_label(GTK_BUTTON(show_password_button_),
+ gtk_label_set_text(GTK_LABEL(page->password_), "");
+ gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON).c_str());
return;
}
// Show the password.
GtkTreeIter iter;
- if (!gtk_tree_selection_get_selected(password_selection_,
+ if (!gtk_tree_selection_get_selected(page->password_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(password_list_sort_), &iter);
+ GTK_TREE_MODEL(page->password_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- password_list_sort_, path);
+ page->password_list_sort_, path);
gtk_tree_path_free(path);
- std::string pass = UTF16ToUTF8(password_list_[index].password_value);
- gtk_label_set_text(GTK_LABEL(password_), pass.c_str());
- gtk_button_set_label(GTK_BUTTON(show_password_button_),
+ std::string pass = UTF16ToUTF8(page->password_list_[index].password_value);
+ gtk_label_set_text(GTK_LABEL(page->password_), pass.c_str());
+ gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON).c_str());
}
-void PasswordsPageGtk::OnPasswordSelectionChanged(GtkTreeSelection* selection) {
+// static
+void PasswordsPageGtk::OnPasswordSelectionChanged(GtkTreeSelection* selection,
+ PasswordsPageGtk* page) {
// No matter how the selection changed, we want to hide the old password.
- gtk_label_set_text(GTK_LABEL(password_), "");
- gtk_button_set_label(GTK_BUTTON(show_password_button_),
+ gtk_label_set_text(GTK_LABEL(page->password_), "");
+ gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON).c_str());
- password_showing_ = false;
+ page->password_showing_ = false;
GtkTreeIter iter;
if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) {
- gtk_widget_set_sensitive(show_password_button_, FALSE);
- gtk_widget_set_sensitive(remove_button_, FALSE);
+ gtk_widget_set_sensitive(page->show_password_button_, FALSE);
+ gtk_widget_set_sensitive(page->remove_button_, FALSE);
return;
}
- gtk_widget_set_sensitive(show_password_button_, TRUE);
- gtk_widget_set_sensitive(remove_button_, TRUE);
+ gtk_widget_set_sensitive(page->show_password_button_, TRUE);
+ gtk_widget_set_sensitive(page->remove_button_, TRUE);
}
// static
diff --git a/chrome/browser/gtk/options/passwords_page_gtk.h b/chrome/browser/gtk/options/passwords_page_gtk.h
index 9cf8e38..891f36b 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_page_gtk.h
@@ -9,7 +9,6 @@
#include <vector>
-#include "app/gtk_signal.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/profile.h"
@@ -32,16 +31,24 @@ class PasswordsPageGtk {
// Sets the password list contents to the given data.
void SetPasswordList(const std::vector<webkit_glue::PasswordForm*>& result);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveButtonClicked);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnRemoveAllButtonClicked);
- CHROMEGTK_CALLBACK_1(PasswordsPageGtk, void, OnRemoveAllConfirmResponse, int);
- CHROMEGTK_CALLBACK_0(PasswordsPageGtk, void, OnShowPasswordButtonClicked);
+ // Callback for the remove button.
+ static void OnRemoveButtonClicked(GtkButton* widget, PasswordsPageGtk* page);
- static void OnPasswordSelectionChangedThunk(GtkTreeSelection* selection,
- PasswordsPageGtk* page) {
- page->OnPasswordSelectionChanged(selection);
- }
- void OnPasswordSelectionChanged(GtkTreeSelection* selection);
+ // Callback for the remove all button.
+ static void OnRemoveAllButtonClicked(GtkButton* widget,
+ PasswordsPageGtk* page);
+
+ // Callback for the remove all confirmation response.
+ static void OnRemoveAllConfirmResponse(GtkDialog* confirm, gint response,
+ PasswordsPageGtk* page);
+
+ // Callback for the show password button.
+ static void OnShowPasswordButtonClicked(GtkButton* widget,
+ PasswordsPageGtk* page);
+
+ // Callback for selection changed events.
+ static void OnPasswordSelectionChanged(GtkTreeSelection* selection,
+ PasswordsPageGtk* page);
// Sorting functions.
static gint CompareSite(GtkTreeModel* model,
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
index d1b708a..fde744d 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
@@ -69,7 +69,7 @@ UrlPickerDialogGtk::UrlPickerDialogGtk(UrlPickerCallback* callback,
accessible_widget_helper_->SetWidgetName(url_entry_, IDS_ASI_URL);
gtk_entry_set_activates_default(GTK_ENTRY(url_entry_), TRUE);
g_signal_connect(url_entry_, "changed",
- G_CALLBACK(OnUrlEntryChangedThunk), this);
+ G_CALLBACK(OnUrlEntryChanged), this);
gtk_box_pack_start(GTK_BOX(url_hbox), url_entry_,
TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog_)->vbox), url_hbox,
@@ -110,7 +110,7 @@ UrlPickerDialogGtk::UrlPickerDialogGtk(UrlPickerCallback* callback,
gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(history_tree_),
TRUE);
g_signal_connect(history_tree_, "row-activated",
- G_CALLBACK(OnHistoryRowActivatedThunk), this);
+ G_CALLBACK(OnHistoryRowActivated), this);
history_selection_ = gtk_tree_view_get_selection(
GTK_TREE_VIEW(history_tree_));
@@ -168,8 +168,8 @@ UrlPickerDialogGtk::UrlPickerDialogGtk(UrlPickerCallback* callback,
gtk_widget_show_all(dialog_);
- g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
- g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this);
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnResponse), this);
+ g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
}
UrlPickerDialogGtk::~UrlPickerDialogGtk() {
@@ -237,8 +237,10 @@ gint UrlPickerDialogGtk::CompareURL(GtkTreeModel* model,
CompareValues(row1, row2, IDS_ASI_URL_COLUMN);
}
-void UrlPickerDialogGtk::OnUrlEntryChanged(GtkWidget* editable) {
- EnableControls();
+// static
+void UrlPickerDialogGtk::OnUrlEntryChanged(GtkEditable* editable,
+ UrlPickerDialogGtk* window) {
+ window->EnableControls();
}
// static
@@ -256,20 +258,26 @@ void UrlPickerDialogGtk::OnHistorySelectionChanged(
gtk_tree_path_free(path);
}
-void UrlPickerDialogGtk::OnHistoryRowActivated(GtkWidget* tree_view,
+void UrlPickerDialogGtk::OnHistoryRowActivated(GtkTreeView* tree_view,
GtkTreePath* path,
- GtkTreeViewColumn* column) {
- GURL url(URLFixerUpper::FixupURL(GetURLForPath(path), ""));
- callback_->Run(url);
- gtk_widget_destroy(dialog_);
+ GtkTreeViewColumn* column,
+ UrlPickerDialogGtk* window) {
+ GURL url(URLFixerUpper::FixupURL(window->GetURLForPath(path), ""));
+ window->callback_->Run(url);
+ gtk_widget_destroy(window->dialog_);
}
-void UrlPickerDialogGtk::OnResponse(GtkWidget* dialog, int response_id) {
- if (response_id == GTK_RESPONSE_OK)
- AddURL();
- gtk_widget_destroy(dialog_);
+// static
+void UrlPickerDialogGtk::OnResponse(GtkDialog* dialog, int response_id,
+ UrlPickerDialogGtk* window) {
+ if (response_id == GTK_RESPONSE_OK) {
+ window->AddURL();
+ }
+ gtk_widget_destroy(window->dialog_);
}
-void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget) {
- MessageLoop::current()->DeleteSoon(FROM_HERE, this);
+// static
+void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget,
+ UrlPickerDialogGtk* window) {
+ MessageLoop::current()->DeleteSoon(FROM_HERE, window);
}
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.h b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
index a911cc7..3c12f95 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.h
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
@@ -7,7 +7,6 @@
#include <string>
-#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/callback.h"
#include "chrome/browser/gtk/gtk_tree.h"
@@ -47,16 +46,27 @@ class UrlPickerDialogGtk : public gtk_tree::TableAdapter::Delegate {
static gint CompareURL(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
gpointer window);
- CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnUrlEntryChanged);
- CHROMEGTK_CALLBACK_2(UrlPickerDialogGtk, void, OnHistoryRowActivated,
- GtkTreePath*, GtkTreeViewColumn*);
- CHROMEGTK_CALLBACK_1(UrlPickerDialogGtk, void, OnResponse, int);
- CHROMEGTK_CALLBACK_0(UrlPickerDialogGtk, void, OnWindowDestroy);
+ // Callback for URL entry changes.
+ static void OnUrlEntryChanged(GtkEditable* editable,
+ UrlPickerDialogGtk* window);
// Callback for user selecting rows in recent history list.
static void OnHistorySelectionChanged(GtkTreeSelection* selection,
UrlPickerDialogGtk* window);
+ // Callback for user activating a row in recent history list.
+ static void OnHistoryRowActivated(GtkTreeView* tree_view,
+ GtkTreePath* path,
+ GtkTreeViewColumn* column,
+ UrlPickerDialogGtk* window);
+
+ // Callback for dialog buttons.
+ static void OnResponse(GtkDialog* dialog, int response_id,
+ UrlPickerDialogGtk* window);
+
+ // Callback for window destruction.
+ static void OnWindowDestroy(GtkWidget* widget, UrlPickerDialogGtk* window);
+
// The dialog window.
GtkWidget* dialog_;