diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 19:41:00 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-23 19:41:00 +0000 |
commit | 18ca30f42aaa36d5bbabaecb1347c82f7fea3788 (patch) | |
tree | 4d1ea9cc4a98615608afbb3967e97146c1982e04 | |
parent | 5b11196f3bafa5480a92edc5a2cc0ef24cf2a4ea (diff) | |
download | chromium_src-18ca30f42aaa36d5bbabaecb1347c82f7fea3788.zip chromium_src-18ca30f42aaa36d5bbabaecb1347c82f7fea3788.tar.gz chromium_src-18ca30f42aaa36d5bbabaecb1347c82f7fea3788.tar.bz2 |
GTK: Set initial size for js alert.
BUG=28058
Review URL: http://codereview.chromium.org/426008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32828 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/resources/locale_settings.grd | 5 | ||||
-rw-r--r-- | chrome/browser/app_modal_dialog_gtk.cc | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/chrome/app/resources/locale_settings.grd b/chrome/app/resources/locale_settings.grd index 43231b2..3654f96 100644 --- a/chrome/app/resources/locale_settings.grd +++ b/chrome/app/resources/locale_settings.grd @@ -556,6 +556,11 @@ 3 </message> + <!-- The minimum width of javascript alert popups. --> + <message name="IDS_ALERT_DIALOG_WIDTH_CHARS" use_name_for_id="true"> + 30 + </message> + <!-- Locale-dependent static encodings string --> <message name="IDS_STATIC_ENCODING_LIST" use_name_for_id="true"> ISO-8859-1,windows-1252 diff --git a/chrome/browser/app_modal_dialog_gtk.cc b/chrome/browser/app_modal_dialog_gtk.cc index a408eb6..9587624 100644 --- a/chrome/browser/app_modal_dialog_gtk.cc +++ b/chrome/browser/app_modal_dialog_gtk.cc @@ -14,7 +14,9 @@ #include "chrome/browser/browser_window.h" #include "chrome/browser/tab_contents/tab_contents.h" #include "chrome/browser/tab_contents/tab_contents_view.h" +#include "chrome/common/gtk_util.h" #include "grit/generated_resources.h" +#include "grit/locale_settings.h" namespace { @@ -171,6 +173,16 @@ void AppModalDialog::CreateAndShowDialog() { gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_OK); g_signal_connect(dialog_, "response", G_CALLBACK(OnDialogResponse), this); + // Suggest a minimum size. + gtk_widget_realize(dialog_); + gint width; + GtkRequisition req; + gtk_widget_size_request(dialog_, &req); + gtk_util::GetWidgetSizeFromResources(dialog_, IDS_ALERT_DIALOG_WIDTH_CHARS, 0, + &width, NULL); + if (width > req.width) + gtk_widget_set_size_request(dialog_, width, -1); + gtk_widget_show_all(GTK_WIDGET(GTK_DIALOG(dialog_))); } |