summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-09 00:52:19 +0000
committerevan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-09 00:52:19 +0000
commit3a991672550ca9b6f4046ab1232caf8d48d14b23 (patch)
treed4e92a6c4dfaea27ff8c962daf4fa210bc40c148 /chrome/common
parent635437c0531761ca0cf7a9de06ba1c4b3bbb9c44 (diff)
downloadchromium_src-3a991672550ca9b6f4046ab1232caf8d48d14b23.zip
chromium_src-3a991672550ca9b6f4046ab1232caf8d48d14b23.tar.gz
chromium_src-3a991672550ca9b6f4046ab1232caf8d48d14b23.tar.bz2
linux: set a minimum size for dialogs based on locale resources
GTK dialogs size to their contents, but sometimes the title is the longest string available. BUG=28024 Review URL: http://codereview.chromium.org/534006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/gtk_util.cc13
-rw-r--r--chrome/common/gtk_util.h7
2 files changed, 20 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc
index 75a5acf..f63fd69 100644
--- a/chrome/common/gtk_util.cc
+++ b/chrome/common/gtk_util.cc
@@ -219,6 +219,19 @@ void GetWidgetSizeFromCharacters(GtkWidget* widget, double width_chars,
g_object_unref(context);
}
+void SetWindowWidthFromResources(GtkWindow* window, int resource_id,
+ bool resizable) {
+ int width;
+ gtk_util::GetWidgetSizeFromResources(GTK_WIDGET(window), resource_id, 0,
+ &width, NULL);
+ if (resizable) {
+ gtk_window_set_default_size(window, width, -1);
+ } else {
+ gtk_widget_set_size_request(GTK_WIDGET(window), width, -1);
+ }
+ gtk_window_set_resizable(window, resizable ? TRUE : FALSE);
+}
+
void RemoveAllChildren(GtkWidget* container) {
gtk_container_foreach(GTK_CONTAINER(container), RemoveWidget, container);
}
diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h
index f92c3ad..1e7c636 100644
--- a/chrome/common/gtk_util.h
+++ b/chrome/common/gtk_util.h
@@ -81,6 +81,13 @@ void GetWidgetSizeFromResources(GtkWidget* widget, int width_chars,
void GetWidgetSizeFromCharacters(GtkWidget* widget, double width_chars,
double height_lines, int* width, int* height);
+// As above, but a convenience method for configuring dialog width.
+// |resizable| also controls whether the dialog will be resizable
+// (this info is also necessary for getting the width-setting code
+// right).
+void SetWindowWidthFromResources(GtkWindow* window, int resource_id,
+ bool resizable);
+
// Remove all children from this container.
void RemoveAllChildren(GtkWidget* container);