diff options
author | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 20:58:28 +0000 |
---|---|---|
committer | zork@chromium.org <zork@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-12-16 20:58:28 +0000 |
commit | 969ee0d4eb01ab770892020e5ba7baf4bf4fda6a (patch) | |
tree | e9d1c707959392f8d7156f5b64dd330e514c813c /chrome/common | |
parent | 3762aeb6b417e032ff7d97acaf02670fd2b83248 (diff) | |
download | chromium_src-969ee0d4eb01ab770892020e5ba7baf4bf4fda6a.zip chromium_src-969ee0d4eb01ab770892020e5ba7baf4bf4fda6a.tar.gz chromium_src-969ee0d4eb01ab770892020e5ba7baf4bf4fda6a.tar.bz2 |
Fix labels on the content options page to wrap properly. Also, add a utility function to allow other labels to do the same.
BUG=29797
TEST=Open the content options page, and check that the labels wrap at the width of the page.
Review URL: http://codereview.chromium.org/500026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34745 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/gtk_util.cc | 10 | ||||
-rw-r--r-- | chrome/common/gtk_util.h | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 9154b92..5b078fb 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -113,6 +113,11 @@ gboolean PaintNoBackground(GtkWidget* widget, return TRUE; } +void OnLabelAllocate(GtkWidget* label, GtkAllocation* allocation, + gpointer user_data) { + gtk_widget_set_size_request(label, allocation->width, -1); +} + } // namespace namespace event_utils { @@ -660,4 +665,9 @@ void SuppressDefaultPainting(GtkWidget* container) { G_CALLBACK(PaintNoBackground), NULL); } +void WrapLabelAtAllocationHack(GtkWidget* label) { + g_signal_connect(label, "size-allocate", + G_CALLBACK(OnLabelAllocate), NULL); +} + } // namespace gtk_util diff --git a/chrome/common/gtk_util.h b/chrome/common/gtk_util.h index b46db0a..4eab8c6 100644 --- a/chrome/common/gtk_util.h +++ b/chrome/common/gtk_util.h @@ -213,6 +213,15 @@ void ApplyMessageDialogQuirks(GtkWidget* dialog); // expose events are connected. void SuppressDefaultPainting(GtkWidget* container); +// Set the label to use a request size equal to the allocation size. This +// causes the label to wrap at the width of the container it is in, instead of +// at the default width. +// This is called a hack because the gtk docs state that it is logically +// inconsistent for a widget to make its size request depend on its allocation. +// It does, however, have the intended effect of wrapping the label at the +// proper width. +void WrapLabelAtAllocationHack(GtkWidget* label); + } // namespace gtk_util #endif // CHROME_COMMON_GTK_UTIL_H_ |