summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 03:00:37 +0000
committerjhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-23 03:00:37 +0000
commit1961e77be011903324a97da5354d267b0fae1904 (patch)
treed98aeeb60397c8dbd50cebe7ed4a4a1e96aad2b0 /chrome
parent5f2f81b706c2e33ac94a09cada59fa29141aff94 (diff)
downloadchromium_src-1961e77be011903324a97da5354d267b0fae1904.zip
chromium_src-1961e77be011903324a97da5354d267b0fae1904.tar.gz
chromium_src-1961e77be011903324a97da5354d267b0fae1904.tar.bz2
gtk: Tie the AutoFill button in the options dialog to the kEnableAutoFill pref.
BUG=38681 TEST=none Review URL: http://codereview.chromium.org/1124005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42304 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.cc41
-rw-r--r--chrome/browser/gtk/options/content_page_gtk.h9
2 files changed, 27 insertions, 23 deletions
diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc
index a539eb9..26951ac 100644
--- a/chrome/browser/gtk/options/content_page_gtk.cc
+++ b/chrome/browser/gtk/options/content_page_gtk.cc
@@ -59,12 +59,13 @@ ContentPageGtk::ContentPageGtk(Profile* profile)
InitSyncGroup(), false);
UpdateSyncControls();
}
+
options_builder.AddOptionGroup(
l10n_util::GetStringUTF8(IDS_OPTIONS_PASSWORDS_GROUP_NAME),
InitPasswordSavingGroup(), false);
options_builder.AddOptionGroup(
l10n_util::GetStringUTF8(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME),
- InitFormAutofillGroup(), false);
+ InitFormAutoFillGroup(), false);
options_builder.AddOptionGroup(
l10n_util::GetStringUTF8(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME),
InitBrowsingDataGroup(), false);
@@ -78,6 +79,7 @@ ContentPageGtk::ContentPageGtk(Profile* profile)
profile->GetPrefs(), this);
enable_form_autofill_.Init(prefs::kAutoFillEnabled,
profile->GetPrefs(), this);
+
if (browser_defaults::kCanToggleSystemTitleBar) {
use_custom_chrome_frame_.Init(prefs::kUseCustomChromeFrame,
profile->GetPrefs(), this);
@@ -132,9 +134,11 @@ void ContentPageGtk::NotifyPrefChanged(const std::wstring* pref_name) {
if (enable_form_autofill_.GetValue()) {
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON(form_autofill_enable_radio_), TRUE);
+ gtk_widget_set_sensitive(autofill_button_, TRUE);
} else {
gtk_toggle_button_set_active(
GTK_TOGGLE_BUTTON(form_autofill_disable_radio_), TRUE);
+ gtk_widget_set_sensitive(autofill_button_, FALSE);
}
}
if (browser_defaults::kCanToggleSystemTitleBar &&
@@ -217,14 +221,14 @@ GtkWidget* ContentPageGtk::InitPasswordSavingGroup() {
return vbox;
}
-GtkWidget* ContentPageGtk::InitFormAutofillGroup() {
+GtkWidget* ContentPageGtk::InitFormAutoFillGroup() {
GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing);
// Enable radio button.
form_autofill_enable_radio_ = gtk_radio_button_new_with_label(NULL,
l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_ENABLE).c_str());
g_signal_connect(G_OBJECT(form_autofill_enable_radio_), "toggled",
- G_CALLBACK(OnAutofillRadioToggledThunk), this);
+ G_CALLBACK(OnAutoFillRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), form_autofill_enable_radio_, FALSE,
FALSE, 0);
@@ -233,22 +237,22 @@ GtkWidget* ContentPageGtk::InitFormAutofillGroup() {
GTK_RADIO_BUTTON(form_autofill_enable_radio_),
l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_DISABLE).c_str());
g_signal_connect(G_OBJECT(form_autofill_disable_radio_), "toggled",
- G_CALLBACK(OnAutofillRadioToggledThunk), this);
+ G_CALLBACK(OnAutoFillRadioToggledThunk), this);
gtk_box_pack_start(GTK_BOX(vbox), form_autofill_disable_radio_, FALSE,
FALSE, 0);
GtkWidget* button_hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing);
gtk_container_add(GTK_CONTAINER(vbox), button_hbox);
- // Autofill button.
- GtkWidget* autofill_button = gtk_button_new_with_label(
+ // AutoFill button.
+ autofill_button_ = gtk_button_new_with_label(
l10n_util::GetStringUTF8(IDS_OPTIONS_AUTOFILL_SETTINGS).c_str());
- if (!personal_data_)
- gtk_widget_set_sensitive(autofill_button, FALSE);
+ if (!profile()->GetPrefs()->GetBoolean(prefs::kAutoFillEnabled))
+ gtk_widget_set_sensitive(autofill_button_, FALSE);
- g_signal_connect(G_OBJECT(autofill_button), "clicked",
- G_CALLBACK(OnAutofillButtonClickedThunk), this);
- gtk_box_pack_start(GTK_BOX(button_hbox), autofill_button, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(autofill_button_), "clicked",
+ G_CALLBACK(OnAutoFillButtonClickedThunk), this);
+ gtk_box_pack_start(GTK_BOX(button_hbox), autofill_button_, FALSE, FALSE, 0);
return vbox;
}
@@ -401,7 +405,7 @@ void ContentPageGtk::UpdateSyncControls() {
}
}
-void ContentPageGtk::OnAutofillButtonClicked(GtkWidget* widget) {
+void ContentPageGtk::OnAutoFillButtonClicked(GtkWidget* widget) {
DCHECK(personal_data_);
// If the personal data manager has not loaded the data yet, set ourselves as
// its observer so that we can listen for the OnPersonalDataLoaded signal.
@@ -418,20 +422,17 @@ void ContentPageGtk::OnImportButtonClicked(GtkWidget* widget) {
}
void ContentPageGtk::OnGtkThemeButtonClicked(GtkWidget* widget) {
- UserMetricsRecordAction("Options_GtkThemeSet",
- profile()->GetPrefs());
+ UserMetricsRecordAction("Options_GtkThemeSet", profile()->GetPrefs());
profile()->SetNativeTheme();
}
void ContentPageGtk::OnResetDefaultThemeButtonClicked(GtkWidget* widget) {
- UserMetricsRecordAction("Options_ThemesReset",
- profile()->GetPrefs());
+ UserMetricsRecordAction("Options_ThemesReset", profile()->GetPrefs());
profile()->ClearTheme();
}
void ContentPageGtk::OnGetThemesButtonClicked(GtkWidget* widget) {
- UserMetricsRecordAction("Options_ThemesGallery",
- profile()->GetPrefs());
+ UserMetricsRecordAction("Options_ThemesGallery", profile()->GetPrefs());
BrowserList::GetLastActive()->OpenThemeGalleryTabAndActivate();
}
@@ -485,7 +486,7 @@ void ContentPageGtk::OnPasswordRadioToggled(GtkWidget* widget) {
ask_to_save_passwords_.SetValue(enabled);
}
-void ContentPageGtk::OnAutofillRadioToggled(GtkWidget* widget) {
+void ContentPageGtk::OnAutoFillRadioToggled(GtkWidget* widget) {
if (initializing_)
return;
@@ -500,9 +501,11 @@ void ContentPageGtk::OnAutofillRadioToggled(GtkWidget* widget) {
if (enabled) {
UserMetricsRecordAction("Options_FormAutofill_Enable",
profile()->GetPrefs());
+ gtk_widget_set_sensitive(autofill_button_, TRUE);
} else {
UserMetricsRecordAction("Options_FormAutofill_Disable",
profile()->GetPrefs());
+ gtk_widget_set_sensitive(autofill_button_, FALSE);
}
enable_form_autofill_.SetValue(enabled);
}
diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h
index 5f328d3..d9d7fa5 100644
--- a/chrome/browser/gtk/options/content_page_gtk.h
+++ b/chrome/browser/gtk/options/content_page_gtk.h
@@ -48,7 +48,7 @@ class ContentPageGtk : public OptionsPageBase,
// Initialize the option group widgets, return their container.
GtkWidget* InitPasswordSavingGroup();
- GtkWidget* InitFormAutofillGroup();
+ GtkWidget* InitFormAutoFillGroup();
GtkWidget* InitBrowsingDataGroup();
GtkWidget* InitThemesGroup();
GtkWidget* InitSyncGroup();
@@ -60,8 +60,8 @@ class ContentPageGtk : public OptionsPageBase,
CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSystemTitleBarRadioToggled);
CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnShowPasswordsButtonClicked);
CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnPasswordRadioToggled);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutofillButtonClicked);
- CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutofillRadioToggled);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutoFillButtonClicked);
+ CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnAutoFillRadioToggled);
CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncStartStopButtonClicked);
CHROMEGTK_CALLBACK_0(ContentPageGtk, void, OnSyncActionLinkClicked);
CHROMEGTK_CALLBACK_1(ContentPageGtk, void, OnStopSyncDialogResponse, int);
@@ -70,9 +70,10 @@ class ContentPageGtk : public OptionsPageBase,
GtkWidget* passwords_asktosave_radio_;
GtkWidget* passwords_neversave_radio_;
- // Widgets for the Form Autofill group.
+ // Widgets for the Form AutoFill group.
GtkWidget* form_autofill_enable_radio_;
GtkWidget* form_autofill_disable_radio_;
+ GtkWidget* autofill_button_;
// Widgets for the Appearance group.
GtkWidget* system_title_bar_show_radio_;