diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 21:03:15 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 21:03:15 +0000 |
commit | aeba30900935cfbb729e3124e8e2151a581028d9 (patch) | |
tree | dd8439daa058691fb5b055c3af650c1372a86af9 /chrome | |
parent | 619d6e06a1c0003712b777711e956db4a63572f2 (diff) | |
download | chromium_src-aeba30900935cfbb729e3124e8e2151a581028d9.zip chromium_src-aeba30900935cfbb729e3124e8e2151a581028d9.tar.gz chromium_src-aeba30900935cfbb729e3124e8e2151a581028d9.tar.bz2 |
Switch to using radio buttons for toggling the custom frame. Use
title case for the context menu on the title bar.
BUG=23412
Review URL: http://codereview.chromium.org/255059
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27896 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/generated_resources.grd | 19 | ||||
-rw-r--r-- | chrome/browser/gtk/browser_titlebar.cc | 2 | ||||
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.cc | 65 | ||||
-rw-r--r-- | chrome/browser/gtk/options/content_page_gtk.h | 11 |
4 files changed, 71 insertions, 26 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 0218501..ea1de94 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -4093,6 +4093,12 @@ Keep your key file in a safe place. You will need it to create new versions of y <message name="IDS_THEMES_SET_CLASSIC" desc="The button to choose the classic windows theme in GTK"> Use Classic theme </message> + <message name="IDS_SHOW_WINDOW_DECORATIONS_RADIO" desc="A radio button in the options dialog for using the system title bar and borders."> + Use system title bar and borders + </message> + <message name="IDS_HIDE_WINDOW_DECORATIONS_RADIO" desc="A radio button in the options dialog for using the chrome custom frame and hiding the system title bar."> + Hide system title bar and use compact borders + </message> </if> <message name="IDS_THEMES_RESET_BUTTON" desc="The button to reset your theme"> Reset to default theme @@ -5134,9 +5140,16 @@ Keep your key file in a safe place. You will need it to create new versions of y Don't ask again </message> - <message name="IDS_SHOW_WINDOW_DECORATIONS" desc="The menu entry text in the tab strip context menu. This toggles the system title bar and window borders (window decorations) on linux."> - Use system title bar and borders - </message> + <if expr="not pp_ifdef('use_titlecase')"> + <message name="IDS_SHOW_WINDOW_DECORATIONS_MENU" desc="The menu entry text in the tab strip context menu. This toggles the system title bar and window borders (window decorations) on linux."> + Use system title bar and borders + </message> + </if> + <if expr="pp_ifdef('use_titlecase')"> + <message name="IDS_SHOW_WINDOW_DECORATIONS_MENU" desc="In Title Case: The menu entry text in the tab strip context menu. This toggles the system title bar and window borders (window decorations) on linux."> + Use System Title Bar and Borders + </message> + </if> <message name="IDS_RGBA_CSS_FORMAT_STRING" translateable="false" desc="The format string to use when converting colors to CSS rgba()."> rgba($1, $2, $3, $4) diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc index a78954d..791b1f3 100644 --- a/chrome/browser/gtk/browser_titlebar.cc +++ b/chrome/browser/gtk/browser_titlebar.cc @@ -573,7 +573,7 @@ void BrowserTitlebar::ShowContextMenu() { #if !defined(OS_CHROMEOS) { MENU_SEPARATOR }, { MENU_CHECKBOX, kShowWindowDecorationsCommand, - IDS_SHOW_WINDOW_DECORATIONS }, + IDS_SHOW_WINDOW_DECORATIONS_MENU }, #endif { MENU_END }, }; diff --git a/chrome/browser/gtk/options/content_page_gtk.cc b/chrome/browser/gtk/options/content_page_gtk.cc index 6c9b4d2..afc1ca8 100644 --- a/chrome/browser/gtk/options/content_page_gtk.cc +++ b/chrome/browser/gtk/options/content_page_gtk.cc @@ -28,7 +28,6 @@ ContentPageGtk::ContentPageGtk(Profile* profile) : OptionsPageBase(profile), - system_title_bar_checkbox_(NULL), initializing_(true) { // Prepare the group options layout. @@ -89,9 +88,13 @@ void ContentPageGtk::NotifyPrefChanged(const std::wstring* pref_name) { } if (browser_defaults::kCanToggleSystemTitleBar && (!pref_name || *pref_name == prefs::kUseCustomChromeFrame)) { - gtk_toggle_button_set_active( - GTK_TOGGLE_BUTTON(system_title_bar_checkbox_), - !use_custom_chrome_frame_.GetValue()); + if (use_custom_chrome_frame_.GetValue()) { + gtk_toggle_button_set_active( + GTK_TOGGLE_BUTTON(system_title_bar_hide_radio_), TRUE); + } else { + gtk_toggle_button_set_active( + GTK_TOGGLE_BUTTON(system_title_bar_show_radio_), TRUE); + } } initializing_ = false; } @@ -191,16 +194,6 @@ GtkWidget* ContentPageGtk::InitThemesGroup() { GtkWidget* vbox = gtk_vbox_new(FALSE, gtk_util::kControlSpacing); GtkWidget* hbox = gtk_hbox_new(FALSE, gtk_util::kControlSpacing); - // "Use system title bar and borders" checkbox. - if (browser_defaults::kCanToggleSystemTitleBar) { - system_title_bar_checkbox_ = gtk_check_button_new_with_label( - l10n_util::GetStringUTF8(IDS_SHOW_WINDOW_DECORATIONS).c_str()); - g_signal_connect(G_OBJECT(system_title_bar_checkbox_), "clicked", - G_CALLBACK(OnSystemTitleBarCheckboxClicked), this); - gtk_box_pack_start(GTK_BOX(vbox), system_title_bar_checkbox_, - FALSE, FALSE, 0); - } - #if defined(TOOLKIT_GTK) // GTK theme button. GtkWidget* gtk_theme_button = gtk_button_new_with_label( @@ -226,6 +219,26 @@ GtkWidget* ContentPageGtk::InitThemesGroup() { gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); + // "Use system title bar and borders" radio buttons. + if (browser_defaults::kCanToggleSystemTitleBar) { + // Use system title bar and borders + system_title_bar_show_radio_ = gtk_radio_button_new_with_label(NULL, + l10n_util::GetStringUTF8(IDS_SHOW_WINDOW_DECORATIONS_RADIO).c_str()); + g_signal_connect(G_OBJECT(system_title_bar_show_radio_), "toggled", + G_CALLBACK(OnSystemTitleBarRadioToggled), this); + gtk_box_pack_start(GTK_BOX(vbox), system_title_bar_show_radio_, FALSE, + FALSE, 0); + + // Hide system title bar and use custom borders + system_title_bar_hide_radio_ = gtk_radio_button_new_with_label_from_widget( + GTK_RADIO_BUTTON(system_title_bar_show_radio_), + l10n_util::GetStringUTF8(IDS_HIDE_WINDOW_DECORATIONS_RADIO).c_str()); + g_signal_connect(G_OBJECT(system_title_bar_hide_radio_), "toggled", + G_CALLBACK(OnSystemTitleBarRadioToggled), this); + gtk_box_pack_start(GTK_BOX(vbox), system_title_bar_hide_radio_, FALSE, + FALSE, 0); + } + return vbox; } @@ -272,10 +285,28 @@ void ContentPageGtk::OnGetThemesButtonClicked(GtkButton* widget, } // static -void ContentPageGtk::OnSystemTitleBarCheckboxClicked(GtkButton* widget, - ContentPageGtk* page) { +void ContentPageGtk::OnSystemTitleBarRadioToggled(GtkToggleButton* widget, + ContentPageGtk* page) { DCHECK(browser_defaults::kCanToggleSystemTitleBar); - bool use_custom = !gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); + if (page->initializing_) + return; + + // We get two signals when selecting a radio button, one for the old radio + // being toggled off and one for the new one being toggled on. Ignore the + // signal for the toggling off the old button. + if (!gtk_toggle_button_get_active(widget)) + return; + + bool use_custom = gtk_toggle_button_get_active( + GTK_TOGGLE_BUTTON(page->system_title_bar_hide_radio_)); + if (use_custom) { + page->UserMetricsRecordAction(L"Options_CustomFrame_Enable", + page->profile()->GetPrefs()); + } else { + page->UserMetricsRecordAction(L"Options_CustomFrame_Disable", + page->profile()->GetPrefs()); + } + page->use_custom_chrome_frame_.SetValue(use_custom); } diff --git a/chrome/browser/gtk/options/content_page_gtk.h b/chrome/browser/gtk/options/content_page_gtk.h index 4bc27a8..4c7f8d5 100644 --- a/chrome/browser/gtk/options/content_page_gtk.h +++ b/chrome/browser/gtk/options/content_page_gtk.h @@ -49,9 +49,9 @@ class ContentPageGtk : public OptionsPageBase { static void OnGetThemesButtonClicked(GtkButton* widget, ContentPageGtk* page); - // Callback for system title bar checkbox. - static void OnSystemTitleBarCheckboxClicked(GtkButton* widget, - ContentPageGtk* page); + // Callback for system title bar radio buttons. + static void OnSystemTitleBarRadioToggled(GtkToggleButton* widget, + ContentPageGtk* page); // Callback for passwords exceptions button. static void OnPasswordsExceptionsButtonClicked(GtkButton* widget, @@ -73,8 +73,9 @@ class ContentPageGtk : public OptionsPageBase { GtkWidget* form_autofill_asktosave_radio_; GtkWidget* form_autofill_neversave_radio_; - // Widgets for the Themes group. - GtkWidget* system_title_bar_checkbox_; + // Widgets for the Appearance group. + GtkWidget* system_title_bar_show_radio_; + GtkWidget* system_title_bar_hide_radio_; // The parent GtkTable widget GtkWidget* page_; |