diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 19:44:58 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-19 19:44:58 +0000 |
commit | dcbb4d58a0f5526537b7398a51bd9518333e9c4a (patch) | |
tree | f0aa3540001e2b3f62f54bc8990b6f207ceee763 /chrome/common | |
parent | 40d54d49d940651ecbbab0671d29d33b71153414 (diff) | |
download | chromium_src-dcbb4d58a0f5526537b7398a51bd9518333e9c4a.zip chromium_src-dcbb4d58a0f5526537b7398a51bd9518333e9c4a.tar.gz chromium_src-dcbb4d58a0f5526537b7398a51bd9518333e9c4a.tar.bz2 |
Gtk: try to make sure that the extension error dialog has enough room to show its title.
Of course, many window managers don't show the title at all, don't let you control the size of the window, or will have window decorations that make this technique not work; so this is really only designed to work on gnome metacity/compiz.
BUG=35468
TEST=manual
Review URL: http://codereview.chromium.org/646047
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39479 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/platform_util_linux.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/chrome/common/platform_util_linux.cc b/chrome/common/platform_util_linux.cc index 697f307..5baaefc 100644 --- a/chrome/common/platform_util_linux.cc +++ b/chrome/common/platform_util_linux.cc @@ -93,8 +93,23 @@ void SimpleErrorBox(gfx::NativeWindow parent, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "%s", UTF16ToUTF8(message).c_str()); gtk_util::ApplyMessageDialogQuirks(dialog); gtk_window_set_title(GTK_WINDOW(dialog), UTF16ToUTF8(title).c_str()); + g_signal_connect(dialog, "response", G_CALLBACK(gtk_widget_destroy), NULL); gtk_widget_show_all(dialog); + + // Make sure it's big enough to show the title. + GtkRequisition req; + gtk_widget_size_request(dialog, &req); + int width; + gtk_util::GetWidgetSizeFromCharacters(dialog, title.length(), 0, + &width, NULL); + // The fudge factor accounts for extra space needed by the frame + // decorations as well as width differences between average text and the + // actual title text. + width = width * 1.2 + 50; + + if (width > req.width) + gtk_widget_set_size_request(dialog, width, -1); } /* Warning: this may be either Linux or ChromeOS */ |