diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 23:04:23 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-11 23:04:23 +0000 |
commit | 60627a1fc425b47fd658440a9fad776237a87ec1 (patch) | |
tree | ed0b5fc3e9da3fc8b65b3036375665c6f6a2c384 /chrome/common/gtk_util.cc | |
parent | 589df05308e0d8a014ae4f0501d63c38f1144c6f (diff) | |
download | chromium_src-60627a1fc425b47fd658440a9fad776237a87ec1.zip chromium_src-60627a1fc425b47fd658440a9fad776237a87ec1.tar.gz chromium_src-60627a1fc425b47fd658440a9fad776237a87ec1.tar.bz2 |
GTK: Set the back/forward and bookmark bar menus to always show their images.
This only works for GTK 2.16+.
BUG=21495
Review URL: http://codereview.chromium.org/199099
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26043 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gtk_util.cc')
-rw-r--r-- | chrome/common/gtk_util.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/chrome/common/gtk_util.cc b/chrome/common/gtk_util.cc index 54842eb..090d304 100644 --- a/chrome/common/gtk_util.cc +++ b/chrome/common/gtk_util.cc @@ -474,4 +474,25 @@ GdkColor AverageColors(GdkColor color_one, GdkColor color_two) { return average_color; } +void SetAlwaysShowImage(GtkWidget* image_menu_item) { + // Compile time check: if it's available, just use the API. + // GTK_CHECK_VERSION is TRUE if the passed version is compatible. +#if GTK_CHECK_VERSION(2, 16, 1) + gtk_image_menu_item_set_always_show_image( + GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE); +#else + // Run time check: if the API is not available, set the property manually. + // This will still only work with GTK 2.16+ as the property doesn't exist + // in earlier versions. + // gtk_check_version() returns NULL if the passed version is compatible. + if (!gtk_check_version(2, 16, 1)) { + GValue true_value = { 0 }; + g_value_init(&true_value, G_TYPE_BOOLEAN); + g_value_set_boolean(&true_value, TRUE); + g_object_set_property(G_OBJECT(image_menu_item), "always-show-image", + &true_value); + } +#endif +} + } // namespace gtk_util |