diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 18:22:00 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-03 18:22:00 +0000 |
commit | f3a88811802127f14a28fd0fa0fb8cb4ff0c222d (patch) | |
tree | e44e0db883af3bab3c9170eecd26643202798858 /chrome | |
parent | b614cbb088107996d8e56d30cdecefca9f14d5b6 (diff) | |
download | chromium_src-f3a88811802127f14a28fd0fa0fb8cb4ff0c222d.zip chromium_src-f3a88811802127f14a28fd0fa0fb8cb4ff0c222d.tar.gz chromium_src-f3a88811802127f14a28fd0fa0fb8cb4ff0c222d.tar.bz2 |
GTK: Add stock icons to some dialog buttons.
To be clear, this only adds button images from stock images, and doesn't change the text of the buttons. I chose APPLY for dialogs that involve checkboxes. I chose OK for dialogs without checkboxes.
also
- switched the position of the OK/Cancel buttons on the import lock dialog.
- changed the first run dialog CANCEL button to QUIT, because CANCEL is really confusing in that situation (this is a problem on windows as well).
I couldn't find any other dialogs that are missing button images, but if you see some call em out.
BUG=none
TEST=look at all the pretty images.
Review URL: http://codereview.chromium.org/160493
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22288 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc | 5 | ||||
-rw-r--r-- | chrome/browser/gtk/first_run_dialog.cc | 8 | ||||
-rw-r--r-- | chrome/browser/gtk/import_dialog_gtk.cc | 4 | ||||
-rw-r--r-- | chrome/browser/gtk/import_lock_dialog_gtk.cc | 11 | ||||
-rw-r--r-- | chrome/common/gtk_util.cc | 11 | ||||
-rw-r--r-- | chrome/common/gtk_util.h | 5 |
6 files changed, 33 insertions, 11 deletions
diff --git a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc index 4d0451c..07b911d 100644 --- a/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc +++ b/chrome/browser/gtk/clear_browsing_data_dialog_gtk.cc @@ -28,9 +28,10 @@ ClearBrowsingDataDialogGtk::ClearBrowsingDataDialogGtk(GtkWindow* parent, (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), GTK_STOCK_CLOSE, GTK_RESPONSE_REJECT, - l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_COMMIT).c_str(), - GTK_RESPONSE_ACCEPT, NULL); + gtk_util::AddButtonToDialog(dialog, + l10n_util::GetStringUTF8(IDS_CLEAR_BROWSING_DATA_COMMIT).c_str(), + GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); GtkWidget* content_area = GTK_DIALOG(dialog)->vbox; gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc index 50f2321..5437a3d 100644 --- a/chrome/browser/gtk/first_run_dialog.cc +++ b/chrome/browser/gtk/first_run_dialog.cc @@ -30,11 +30,13 @@ FirstRunDialog::FirstRunDialog(Profile* profile, int& response) l10n_util::GetStringUTF8(IDS_FIRSTRUN_DLG_TITLE).c_str(), NULL, // No parent (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), - GTK_STOCK_CANCEL, + GTK_STOCK_QUIT, GTK_RESPONSE_REJECT, - l10n_util::GetStringUTF8(IDS_FIRSTRUN_DLG_OK).c_str(), - GTK_RESPONSE_ACCEPT, NULL); + gtk_util::AddButtonToDialog(dialog_, + l10n_util::GetStringUTF8(IDS_FIRSTRUN_DLG_OK).c_str(), + GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); + gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE); int width, height; gtk_util::GetWidgetSizeFromResources(dialog_, diff --git a/chrome/browser/gtk/import_dialog_gtk.cc b/chrome/browser/gtk/import_dialog_gtk.cc index 33a12cb..c1cbf35 100644 --- a/chrome/browser/gtk/import_dialog_gtk.cc +++ b/chrome/browser/gtk/import_dialog_gtk.cc @@ -39,9 +39,9 @@ ImportDialogGtk::ImportDialogGtk(GtkWindow* parent, Profile* profile) : // Add import button separately as we might need to disable it, if // no supported browsers found. - GtkWidget* import_button = gtk_dialog_add_button(GTK_DIALOG(dialog_), + GtkWidget* import_button = gtk_util::AddButtonToDialog(dialog_, l10n_util::GetStringUTF8(IDS_IMPORT_COMMIT).c_str(), - GTK_RESPONSE_ACCEPT); + GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT); // TODO(rahulk): find how to set size properly so that the dialog // box width is at least enough to display full title. diff --git a/chrome/browser/gtk/import_lock_dialog_gtk.cc b/chrome/browser/gtk/import_lock_dialog_gtk.cc index 465ccea..748dab3 100644 --- a/chrome/browser/gtk/import_lock_dialog_gtk.cc +++ b/chrome/browser/gtk/import_lock_dialog_gtk.cc @@ -24,12 +24,15 @@ ImportLockDialogGtk::ImportLockDialogGtk(GtkWindow* parent, l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_TITLE).c_str(), parent, (GtkDialogFlags) (GTK_DIALOG_MODAL | GTK_DIALOG_NO_SEPARATOR), - l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_OK).c_str(), - GTK_RESPONSE_ACCEPT, - l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_CANCEL).c_str(), - GTK_RESPONSE_REJECT, NULL); + gtk_util::AddButtonToDialog(dialog_, + l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_CANCEL).c_str(), + GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); + gtk_util::AddButtonToDialog(dialog_, + l10n_util::GetStringUTF8(IDS_IMPORTER_LOCK_OK).c_str(), + GTK_STOCK_OK, GTK_RESPONSE_ACCEPT); + GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox; gtk_box_set_spacing(GTK_BOX(content_area), gtk_util::kContentAreaSpacing); GtkWidget* label = gtk_label_new( diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 19eb595b..6eb67007 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -406,4 +406,15 @@ void SetWindowIcon(GtkWindow* window) { g_list_free(icon_list); } +GtkWidget* AddButtonToDialog(GtkWidget* dialog, const gchar* text, + const gchar* stock_id, gint response_id) { + GtkWidget* button = gtk_button_new_with_label(text); + gtk_button_set_image(GTK_BUTTON(button), + gtk_image_new_from_stock(stock_id, + GTK_ICON_SIZE_BUTTON)); + gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, + response_id); + return button; +} + } // namespace gtk_util diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h index 399cb42..d24442c 100644 --- a/chrome/common/gtk_util.h +++ b/chrome/common/gtk_util.h @@ -133,6 +133,11 @@ bool WidgetContainsCursor(GtkWidget* widget); // border or alt-tab list). void SetWindowIcon(GtkWindow* window); +// Adds an action button with the given text to the dialog. Only useful when you +// want a stock icon but not the stock text to go with it. Returns the button. +GtkWidget* AddButtonToDialog(GtkWidget* dialog, const gchar* text, + const gchar* stock_id, gint response_id); + } // namespace gtk_util #endif // CHROME_COMMON_GTK_UTIL_H_ |