summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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, 262 insertions, 397 deletions
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<size_t>(index) >= fonts_page->sorted_encoding_list_.size()) {
+ static_cast<size_t>(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)));
}
diff --git a/chrome/browser/gtk/options/fonts_page_gtk.h b/chrome/browser/gtk/options/fonts_page_gtk.h
index 31e3fd3..92a44ad 100644
--- a/chrome/browser/gtk/options/fonts_page_gtk.h
+++ b/chrome/browser/gtk/options/fonts_page_gtk.h
@@ -11,6 +11,7 @@
#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"
@@ -36,17 +37,12 @@ class FontsPageGtk : public OptionsPageBase {
// GtkFontSelector returns the value in points not pixels.
void SetFontsFromButton(StringPrefMember* name_pref,
IntegerPrefMember* size_pref,
- 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);
+ 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);
// 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 8aecafe..15db49f 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(OnStartupRadioToggled), this);
+ G_CALLBACK(OnStartupRadioToggledThunk), 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(OnStartupRadioToggled), this);
+ G_CALLBACK(OnStartupRadioToggledThunk), 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(OnStartupRadioToggled), this);
+ G_CALLBACK(OnStartupRadioToggledThunk), 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(OnStartupAddCustomPageClicked), this);
+ G_CALLBACK(OnStartupAddCustomPageClickedThunk), 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(OnStartupRemoveCustomPageClicked), this);
+ G_CALLBACK(OnStartupRemoveCustomPageClickedThunk), 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(OnStartupUseCurrentPageClicked), this);
+ G_CALLBACK(OnStartupUseCurrentPageClickedThunk), 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(OnNewTabIsHomePageToggled), this);
+ G_CALLBACK(OnNewTabIsHomePageToggledThunk), 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(OnNewTabIsHomePageToggled), this);
+ G_CALLBACK(OnNewTabIsHomePageToggledThunk), 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(OnHomepageUseUrlEntryChanged), this);
+ G_CALLBACK(OnHomepageUseUrlEntryChangedThunk), 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(OnShowHomeButtonToggled), this);
+ G_CALLBACK(OnShowHomeButtonToggledThunk), 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(OnDefaultSearchEngineChanged), this);
+ G_CALLBACK(OnDefaultSearchEngineChangedThunk), 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(OnDefaultSearchManageEnginesClicked), this);
+ G_CALLBACK(OnDefaultSearchManageEnginesClickedThunk), 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(OnBrowserUseAsDefaultClicked), this);
+ G_CALLBACK(OnBrowserUseAsDefaultClickedThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), default_browser_use_as_default_button_,
FALSE, FALSE, 0);
@@ -382,133 +382,107 @@ GtkWidget* GeneralPageGtk::InitDefaultBrowserGroup() {
return vbox_alignment;
}
-// static
-void GeneralPageGtk::OnStartupRadioToggled(GtkToggleButton* toggle_button,
- GeneralPageGtk* general_page) {
- if (general_page->initializing_)
+void GeneralPageGtk::OnStartupRadioToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- if (!gtk_toggle_button_get_active(toggle_button)) {
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(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;
}
- 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());
+ 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());
}
}
-// static
-void GeneralPageGtk::OnStartupAddCustomPageClicked(
- GtkButton* button, GeneralPageGtk* general_page) {
+void GeneralPageGtk::OnStartupAddCustomPageClicked(GtkWidget* button) {
new UrlPickerDialogGtk(
- NewCallback(general_page, &GeneralPageGtk::OnAddCustomUrl),
- general_page->profile(),
- GTK_WINDOW(gtk_widget_get_toplevel(general_page->page_)));
+ NewCallback(this, &GeneralPageGtk::OnAddCustomUrl),
+ profile(),
+ GTK_WINDOW(gtk_widget_get_toplevel(page_)));
}
-// static
-void GeneralPageGtk::OnStartupRemoveCustomPageClicked(
- GtkButton* button, GeneralPageGtk* general_page) {
- general_page->RemoveSelectedCustomUrls();
+void GeneralPageGtk::OnStartupRemoveCustomPageClicked(GtkWidget* button) {
+ RemoveSelectedCustomUrls();
}
-// static
-void GeneralPageGtk::OnStartupUseCurrentPageClicked(
- GtkButton* button, GeneralPageGtk* general_page) {
- general_page->SetCustomUrlListFromCurrentPages();
+void GeneralPageGtk::OnStartupUseCurrentPageClicked(GtkWidget* button) {
+ SetCustomUrlListFromCurrentPages();
}
// static
void GeneralPageGtk::OnStartupPagesSelectionChanged(
- GtkTreeSelection *selection, GeneralPageGtk* general_page) {
+ GtkTreeSelection* selection, GeneralPageGtk* general_page) {
general_page->EnableCustomHomepagesControls(true);
}
-// static
-void GeneralPageGtk::OnNewTabIsHomePageToggled(GtkToggleButton* toggle_button,
- GeneralPageGtk* general_page) {
- if (general_page->initializing_)
+void GeneralPageGtk::OnNewTabIsHomePageToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- if (!gtk_toggle_button_get_active(toggle_button)) {
+ if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button))) {
// Ignore the signal for toggling off the old button.
return;
}
- 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);
+ 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);
}
}
-// static
-void GeneralPageGtk::OnHomepageUseUrlEntryChanged(
- GtkEditable* editable,
- GeneralPageGtk* general_page) {
- if (general_page->initializing_)
+void GeneralPageGtk::OnHomepageUseUrlEntryChanged(GtkWidget* editable) {
+ if (initializing_)
return;
- general_page->SetHomepageFromEntry();
+ SetHomepageFromEntry();
}
-// static
-void GeneralPageGtk::OnShowHomeButtonToggled(GtkToggleButton* toggle_button,
- GeneralPageGtk* general_page) {
- if (general_page->initializing_)
+void GeneralPageGtk::OnShowHomeButtonToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- bool enabled = gtk_toggle_button_get_active(toggle_button);
- general_page->show_home_button_.SetValue(enabled);
+ bool enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button));
+ show_home_button_.SetValue(enabled);
if (enabled) {
- general_page->UserMetricsRecordAction("Options_Homepage_ShowHomeButton",
- general_page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_Homepage_ShowHomeButton",
+ profile()->GetPrefs());
} else {
- general_page->UserMetricsRecordAction("Options_Homepage_HideHomeButton",
- general_page->profile()->GetPrefs());
+ UserMetricsRecordAction("Options_Homepage_HideHomeButton",
+ profile()->GetPrefs());
}
}
-// static
-void GeneralPageGtk::OnDefaultSearchEngineChanged(
- GtkComboBox* combo_box,
- GeneralPageGtk* general_page) {
- if (general_page->default_search_initializing_)
+void GeneralPageGtk::OnDefaultSearchEngineChanged(GtkWidget* combo_box) {
+ if (default_search_initializing_)
return;
- general_page->SetDefaultSearchEngineFromComboBox();
+ SetDefaultSearchEngineFromComboBox();
}
-// static
-void GeneralPageGtk::OnDefaultSearchManageEnginesClicked(
- GtkButton* button, GeneralPageGtk* general_page) {
- KeywordEditorView::Show(general_page->profile());
+void GeneralPageGtk::OnDefaultSearchManageEnginesClicked(GtkWidget* button) {
+ KeywordEditorView::Show(profile());
}
-// static
-void GeneralPageGtk::OnBrowserUseAsDefaultClicked(
- GtkButton* button,
- GeneralPageGtk* general_page) {
- general_page->default_browser_worker_->StartSetAsDefaultBrowser();
+void GeneralPageGtk::OnBrowserUseAsDefaultClicked(GtkWidget* button) {
+ default_browser_worker_->StartSetAsDefaultBrowser();
// If the user made Chrome the default browser, then he/she arguably wants
// to be notified when that changes.
- general_page->profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser,
- true);
- general_page->UserMetricsRecordAction("Options_SetAsDefaultBrowser",
- general_page->profile()->GetPrefs());
+ profile()->GetPrefs()->SetBoolean(prefs::kCheckDefaultBrowser, true);
+ UserMetricsRecordAction("Options_SetAsDefaultBrowser",
+ 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 fcb87b2..b1f767c 100644
--- a/chrome/browser/gtk/options/general_page_gtk.h
+++ b/chrome/browser/gtk/options/general_page_gtk.h
@@ -10,6 +10,7 @@
#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"
@@ -85,46 +86,21 @@ class GeneralPageGtk : public OptionsPageBase,
// Sets the home page pref using the value in the entry box
void SetHomepageFromEntry();
- // 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,
+ 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,
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 a94a209..f948ea0 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(OnAddButtonClicked), this);
+ G_CALLBACK(OnAddButtonClickedThunk), 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(OnRemoveButtonClicked), this);
+ G_CALLBACK(OnRemoveButtonClickedThunk), 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(OnMoveUpButtonClicked), this);
+ G_CALLBACK(OnMoveUpButtonClickedThunk), 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(OnMoveDownButtonClicked), this);
+ G_CALLBACK(OnMoveDownButtonClickedThunk), 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(OnEnableSpellCheckingToggled), this);
+ G_CALLBACK(OnEnableSpellCheckingToggledThunk), 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(OnEnableAutoSpellCheckingToggled), this);
+ G_CALLBACK(OnEnableAutoSpellCheckingToggledThunk), this);
gtk_box_pack_start(GTK_BOX(spellchecker_vbox),
enable_autospellcorrect_checkbox_, FALSE, FALSE, 0);
}
@@ -367,82 +367,60 @@ void LanguagesPageGtk::OnSelectionChanged(GtkTreeSelection *selection,
languages_page->EnableControls();
}
-// static
-void LanguagesPageGtk::OnAddButtonClicked(GtkButton* button,
- LanguagesPageGtk* languages_page) {
- new AddLanguageDialog(languages_page->profile(), languages_page);
+void LanguagesPageGtk::OnAddButtonClicked(GtkWidget* button) {
+ new AddLanguageDialog(profile(), this);
}
-// static
-void LanguagesPageGtk::OnRemoveButtonClicked(GtkButton* button,
- LanguagesPageGtk* languages_page) {
+void LanguagesPageGtk::OnRemoveButtonClicked(GtkWidget* button) {
std::set<int> selected_rows;
- gtk_tree::GetSelectedIndicies(languages_page->language_order_selection_,
+ gtk_tree::GetSelectedIndicies(language_order_selection_,
&selected_rows);
int selected_row = 0;
for (std::set<int>::reverse_iterator selected = selected_rows.rbegin();
selected != selected_rows.rend(); ++selected) {
- languages_page->language_order_table_model_->Remove(*selected);
+ language_order_table_model_->Remove(*selected);
selected_row = *selected;
}
- int row_count = languages_page->language_order_table_model_->RowCount();
+ int row_count = 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(languages_page->language_order_tree_));
+ GTK_TREE_VIEW(language_order_tree_));
}
-// static
-void LanguagesPageGtk::OnMoveUpButtonClicked(GtkButton* button,
- LanguagesPageGtk* languages_page) {
- int item_selected = languages_page->FirstSelectedRowNum();
- languages_page->language_order_table_model_->MoveUp(item_selected);
+void LanguagesPageGtk::OnMoveUpButtonClicked(GtkWidget* button) {
+ int item_selected = FirstSelectedRowNum();
+ language_order_table_model_->MoveUp(item_selected);
gtk_tree::SelectAndFocusRowNum(
- item_selected - 1, GTK_TREE_VIEW(languages_page->language_order_tree_));
+ item_selected - 1, GTK_TREE_VIEW(language_order_tree_));
}
-// static
-void LanguagesPageGtk::OnMoveDownButtonClicked(
- GtkButton* button, LanguagesPageGtk* languages_page) {
- int item_selected = languages_page->FirstSelectedRowNum();
- languages_page->language_order_table_model_->MoveDown(item_selected);
+void LanguagesPageGtk::OnMoveDownButtonClicked(GtkWidget* button) {
+ int item_selected = FirstSelectedRowNum();
+ language_order_table_model_->MoveDown(item_selected);
gtk_tree::SelectAndFocusRowNum(
- item_selected + 1, GTK_TREE_VIEW(languages_page->language_order_tree_));
+ item_selected + 1, GTK_TREE_VIEW(language_order_tree_));
}
-// static
-void LanguagesPageGtk::OnEnableSpellCheckingToggled(
- GtkToggleButton* toggle_button,
- LanguagesPageGtk* languages_page) {
- if (languages_page->initializing_)
+void LanguagesPageGtk::OnEnableSpellCheckingToggled(GtkWidget* toggle_button) {
+ if (initializing_)
return;
- languages_page->enable_spellcheck_.SetValue(
- gtk_toggle_button_get_active(toggle_button));
+ enable_spellcheck_.SetValue(
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
}
-// static
void LanguagesPageGtk::OnEnableAutoSpellCheckingToggled(
- 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_)
+ GtkWidget* toggle_button) {
+ if (initializing_)
return;
- languages_page->OnDictionaryLanguageChanged();
+ enable_autospellcorrect_.SetValue(
+ gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(toggle_button)));
}
-void LanguagesPageGtk::OnDictionaryLanguageChanged() {
+void LanguagesPageGtk::OnDictionaryLanguageChanged(GtkWidget* widget) {
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 dc44006..b7140ae 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.h
+++ b/chrome/browser/gtk/options/languages_page_gtk.h
@@ -16,6 +16,7 @@
#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"
@@ -62,25 +63,18 @@ 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);
- 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);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnAddButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnRemoveButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveUpButtonClicked);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnMoveDownButtonClicked);
// Callbacks for spellchecker option widgets.
- 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();
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void, OnEnableSpellCheckingToggled);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, void,
+ OnEnableAutoSpellCheckingToggled);
+ CHROMEGTK_CALLBACK_0(LanguagesPageGtk, 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 1bd4c7b..47a203c 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(OnRemoveButtonClicked), this);
+ G_CALLBACK(OnRemoveButtonClickedThunk), 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(OnRemoveAllButtonClicked), this);
+ G_CALLBACK(OnRemoveAllButtonClickedThunk), this);
GtkWidget* buttons = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
gtk_box_pack_start(GTK_BOX(buttons), remove_button_, FALSE, FALSE, 0);
@@ -125,48 +125,41 @@ void PasswordsExceptionsPageGtk::SetExceptionList(
gtk_widget_set_sensitive(remove_all_button_, result.size() > 0);
}
-// static
-void PasswordsExceptionsPageGtk::OnRemoveButtonClicked(
- GtkButton* widget,
- PasswordsExceptionsPageGtk* page) {
+void PasswordsExceptionsPageGtk::OnRemoveButtonClicked(GtkWidget* widget) {
GtkTreeIter iter;
- if (!gtk_tree_selection_get_selected(page->exception_selection_,
+ if (!gtk_tree_selection_get_selected(exception_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(page->exception_list_sort_), &iter);
+ GTK_TREE_MODEL(exception_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- page->exception_list_sort_, path);
+ 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(page->exception_list_sort_), &child_iter, &iter);
+ GTK_TREE_MODEL_SORT(exception_list_sort_), &child_iter, &iter);
// Remove from GTK list, DB, and vector.
- 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_list_store_remove(exception_list_store_, &child_iter);
+ GetPasswordStore()->RemoveLogin(exception_list_[index]);
+ exception_list_.erase(exception_list_.begin() + index);
- gtk_widget_set_sensitive(page->remove_all_button_,
- page->exception_list_.size() > 0);
+ gtk_widget_set_sensitive(remove_all_button_, exception_list_.size() > 0);
}
-// static
-void PasswordsExceptionsPageGtk::OnRemoveAllButtonClicked(
- GtkButton* widget,
- PasswordsExceptionsPageGtk* page) {
+void PasswordsExceptionsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
// Remove from GTK list, DB, and vector.
- 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]);
+ 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]);
}
- page->exception_list_.clear();
- gtk_widget_set_sensitive(page->remove_all_button_, FALSE);
+ exception_list_.clear();
+ gtk_widget_set_sensitive(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 b226f0f..0fd350a 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "app/gtk_signal.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/profile.h"
@@ -34,17 +35,13 @@ class PasswordsExceptionsPageGtk {
// Sets the exception list contents to the given data.
void SetExceptionList(const std::vector<webkit_glue::PasswordForm*>& result);
- // Callback for the remove button.
- static void OnRemoveButtonClicked(GtkButton* widget,
- PasswordsExceptionsPageGtk* page);
+ CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void, OnRemoveButtonClicked);
+ CHROMEGTK_CALLBACK_0(PasswordsExceptionsPageGtk, void,
+ OnRemoveAllButtonClicked);
- // 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);
+ static void OnExceptionSelectionChanged(
+ GtkTreeSelection* selection,
+ PasswordsExceptionsPageGtk* page);
// Sorting function.
static gint CompareSite(GtkTreeModel* model,
@@ -63,6 +60,7 @@ 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 5d21276..a4e06de 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(OnRemoveButtonClicked), this);
+ G_CALLBACK(OnRemoveButtonClickedThunk), 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(OnRemoveAllButtonClicked), this);
+ G_CALLBACK(OnRemoveAllButtonClickedThunk), 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(OnShowPasswordButtonClicked), this);
+ G_CALLBACK(OnShowPasswordButtonClickedThunk), 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(OnPasswordSelectionChanged), this);
+ G_CALLBACK(OnPasswordSelectionChangedThunk), this);
GtkTreeViewColumn* column = gtk_tree_view_column_new_with_attributes(
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN).c_str(),
@@ -171,39 +171,35 @@ void PasswordsPageGtk::SetPasswordList(
gtk_widget_set_sensitive(remove_all_button_, result.size() > 0);
}
-// static
-void PasswordsPageGtk::OnRemoveButtonClicked(GtkButton* widget,
- PasswordsPageGtk* page) {
+void PasswordsPageGtk::OnRemoveButtonClicked(GtkWidget* widget) {
GtkTreeIter iter;
- if (!gtk_tree_selection_get_selected(page->password_selection_,
+ if (!gtk_tree_selection_get_selected(password_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(page->password_list_sort_), &iter);
+ GTK_TREE_MODEL(password_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- page->password_list_sort_, path);
+ 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(page->password_list_sort_), &child_iter, &iter);
+ GTK_TREE_MODEL_SORT(password_list_sort_), &child_iter, &iter);
// Remove from GTK list, DB, and vector.
- 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_list_store_remove(password_list_store_, &child_iter);
+ GetPasswordStore()->RemoveLogin(password_list_[index]);
+ password_list_.erase(password_list_.begin() + index);
- gtk_widget_set_sensitive(page->remove_all_button_,
- page->password_list_.size() > 0);
+ gtk_widget_set_sensitive(remove_all_button_,
+ password_list_.size() > 0);
}
-// static
-void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkButton* widget,
- PasswordsPageGtk* page) {
- GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page->page_));
+void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkWidget* widget) {
+ GtkWindow* window = GTK_WINDOW(gtk_widget_get_toplevel(page_));
GtkWidget* confirm = gtk_message_dialog_new(
window,
static_cast<GtkDialogFlags>(
@@ -216,15 +212,13 @@ void PasswordsPageGtk::OnRemoveAllButtonClicked(GtkButton* 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(OnRemoveAllConfirmResponse),
- page);
+ g_signal_connect(confirm, "response",
+ G_CALLBACK(OnRemoveAllConfirmResponseThunk), this);
gtk_widget_show_all(confirm);
}
-// static
-void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkDialog* confirm,
- gint response,
- PasswordsPageGtk* page) {
+void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkWidget* confirm,
+ gint response) {
bool confirmed = false;
switch (response) {
case GTK_RESPONSE_YES:
@@ -233,66 +227,62 @@ void PasswordsPageGtk::OnRemoveAllConfirmResponse(GtkDialog* confirm,
default:
break;
}
- gtk_widget_destroy(GTK_WIDGET(confirm));
+ gtk_widget_destroy(confirm);
if (!confirmed)
return;
// Remove from GTK list, DB, and vector.
- 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]);
+ 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]);
}
- page->password_list_.clear();
- gtk_widget_set_sensitive(page->remove_all_button_, FALSE);
+ password_list_.clear();
+ gtk_widget_set_sensitive(remove_all_button_, FALSE);
}
-// static
-void PasswordsPageGtk::OnShowPasswordButtonClicked(GtkButton* widget,
- PasswordsPageGtk* page) {
- page->password_showing_ = !page->password_showing_;
- if (!page->password_showing_) {
+void PasswordsPageGtk::OnShowPasswordButtonClicked(GtkWidget* widget) {
+ password_showing_ = !password_showing_;
+ if (!password_showing_) {
// Hide the password.
- gtk_label_set_text(GTK_LABEL(page->password_), "");
- gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
+ gtk_label_set_text(GTK_LABEL(password_), "");
+ gtk_button_set_label(GTK_BUTTON(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(page->password_selection_,
+ if (!gtk_tree_selection_get_selected(password_selection_,
NULL, &iter)) {
NOTREACHED();
return;
}
GtkTreePath* path = gtk_tree_model_get_path(
- GTK_TREE_MODEL(page->password_list_sort_), &iter);
+ GTK_TREE_MODEL(password_list_sort_), &iter);
gint index = gtk_tree::GetTreeSortChildRowNumForPath(
- page->password_list_sort_, path);
+ password_list_sort_, path);
gtk_tree_path_free(path);
- 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_),
+ 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_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON).c_str());
}
-// static
-void PasswordsPageGtk::OnPasswordSelectionChanged(GtkTreeSelection* selection,
- PasswordsPageGtk* page) {
+void PasswordsPageGtk::OnPasswordSelectionChanged(GtkTreeSelection* selection) {
// No matter how the selection changed, we want to hide the old password.
- gtk_label_set_text(GTK_LABEL(page->password_), "");
- gtk_button_set_label(GTK_BUTTON(page->show_password_button_),
+ gtk_label_set_text(GTK_LABEL(password_), "");
+ gtk_button_set_label(GTK_BUTTON(show_password_button_),
l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON).c_str());
- page->password_showing_ = false;
+ password_showing_ = false;
GtkTreeIter iter;
if (!gtk_tree_selection_get_selected(selection, NULL, &iter)) {
- gtk_widget_set_sensitive(page->show_password_button_, FALSE);
- gtk_widget_set_sensitive(page->remove_button_, FALSE);
+ gtk_widget_set_sensitive(show_password_button_, FALSE);
+ gtk_widget_set_sensitive(remove_button_, FALSE);
return;
}
- gtk_widget_set_sensitive(page->show_password_button_, TRUE);
- gtk_widget_set_sensitive(page->remove_button_, TRUE);
+ gtk_widget_set_sensitive(show_password_button_, TRUE);
+ gtk_widget_set_sensitive(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 891f36b..9cf8e38 100644
--- a/chrome/browser/gtk/options/passwords_page_gtk.h
+++ b/chrome/browser/gtk/options/passwords_page_gtk.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "app/gtk_signal.h"
#include "chrome/browser/password_manager/password_store.h"
#include "chrome/browser/profile.h"
@@ -31,24 +32,16 @@ class PasswordsPageGtk {
// Sets the password list contents to the given data.
void SetPasswordList(const std::vector<webkit_glue::PasswordForm*>& result);
- // Callback for the remove button.
- static void OnRemoveButtonClicked(GtkButton* widget, PasswordsPageGtk* page);
+ 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 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);
+ static void OnPasswordSelectionChangedThunk(GtkTreeSelection* selection,
+ PasswordsPageGtk* page) {
+ page->OnPasswordSelectionChanged(selection);
+ }
+ void OnPasswordSelectionChanged(GtkTreeSelection* selection);
// 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 fde744d..d1b708a 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(OnUrlEntryChanged), this);
+ G_CALLBACK(OnUrlEntryChangedThunk), 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(OnHistoryRowActivated), this);
+ G_CALLBACK(OnHistoryRowActivatedThunk), 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(OnResponse), this);
- g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroy), this);
+ g_signal_connect(dialog_, "response", G_CALLBACK(OnResponseThunk), this);
+ g_signal_connect(dialog_, "destroy", G_CALLBACK(OnWindowDestroyThunk), this);
}
UrlPickerDialogGtk::~UrlPickerDialogGtk() {
@@ -237,10 +237,8 @@ gint UrlPickerDialogGtk::CompareURL(GtkTreeModel* model,
CompareValues(row1, row2, IDS_ASI_URL_COLUMN);
}
-// static
-void UrlPickerDialogGtk::OnUrlEntryChanged(GtkEditable* editable,
- UrlPickerDialogGtk* window) {
- window->EnableControls();
+void UrlPickerDialogGtk::OnUrlEntryChanged(GtkWidget* editable) {
+ EnableControls();
}
// static
@@ -258,26 +256,20 @@ void UrlPickerDialogGtk::OnHistorySelectionChanged(
gtk_tree_path_free(path);
}
-void UrlPickerDialogGtk::OnHistoryRowActivated(GtkTreeView* tree_view,
+void UrlPickerDialogGtk::OnHistoryRowActivated(GtkWidget* tree_view,
GtkTreePath* path,
- GtkTreeViewColumn* column,
- UrlPickerDialogGtk* window) {
- GURL url(URLFixerUpper::FixupURL(window->GetURLForPath(path), ""));
- window->callback_->Run(url);
- gtk_widget_destroy(window->dialog_);
+ GtkTreeViewColumn* column) {
+ GURL url(URLFixerUpper::FixupURL(GetURLForPath(path), ""));
+ callback_->Run(url);
+ 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::OnResponse(GtkWidget* dialog, int response_id) {
+ if (response_id == GTK_RESPONSE_OK)
+ AddURL();
+ gtk_widget_destroy(dialog_);
}
-// static
-void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget,
- UrlPickerDialogGtk* window) {
- MessageLoop::current()->DeleteSoon(FROM_HERE, window);
+void UrlPickerDialogGtk::OnWindowDestroy(GtkWidget* widget) {
+ MessageLoop::current()->DeleteSoon(FROM_HERE, this);
}
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.h b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
index 3c12f95..a911cc7 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.h
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.h
@@ -7,6 +7,7 @@
#include <string>
+#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/callback.h"
#include "chrome/browser/gtk/gtk_tree.h"
@@ -46,27 +47,16 @@ class UrlPickerDialogGtk : public gtk_tree::TableAdapter::Delegate {
static gint CompareURL(GtkTreeModel* model, GtkTreeIter* a, GtkTreeIter* b,
gpointer window);
- // Callback for URL entry changes.
- static void OnUrlEntryChanged(GtkEditable* editable,
- UrlPickerDialogGtk* 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 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_;