Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: chrome/common/gtk_util.cc

Issue 199099: GTK: Set the back/forward and bookmark bar menus to always show their images.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: commentary Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/gtk_util.h" 5 #include "chrome/common/gtk_util.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkx.h> 8 #include <gdk/gdkx.h>
9 9
10 #include <cstdarg> 10 #include <cstdarg>
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 467
468 GdkColor AverageColors(GdkColor color_one, GdkColor color_two) { 468 GdkColor AverageColors(GdkColor color_one, GdkColor color_two) {
469 GdkColor average_color; 469 GdkColor average_color;
470 average_color.pixel = 0; 470 average_color.pixel = 0;
471 average_color.red = (color_one.red + color_two.red) / 2; 471 average_color.red = (color_one.red + color_two.red) / 2;
472 average_color.green = (color_one.green + color_two.green) / 2; 472 average_color.green = (color_one.green + color_two.green) / 2;
473 average_color.blue = (color_one.blue + color_two.blue) / 2; 473 average_color.blue = (color_one.blue + color_two.blue) / 2;
474 return average_color; 474 return average_color;
475 } 475 }
476 476
477 void SetAlwaysShowImage(GtkWidget* image_menu_item) {
478 // Compile time check: if it's available, just use the API.
479 // GTK_CHECK_VERSION is TRUE if the passed version is compatible.
480 #if GTK_CHECK_VERSION(2, 16, 1)
481 gtk_image_menu_item_set_always_show_image(
482 GTK_IMAGE_MENU_ITEM(image_menu_item), TRUE);
483 #else
484 // Run time check: if the API is not available, set the property manually.
485 // This will still only work with GTK 2.16+ as the property doesn't exist
486 // in earlier versions.
487 // gtk_check_version() returns NULL if the passed version is compatible.
488 if (!gtk_check_version(2, 16, 1)) {
489 GValue true_value = { 0 };
490 g_value_init(&true_value, G_TYPE_BOOLEAN);
491 g_value_set_boolean(&true_value, TRUE);
492 g_object_set_property(G_OBJECT(image_menu_item), "always-show-image",
493 &true_value);
494 }
495 #endif
496 }
497
477 } // namespace gtk_util 498 } // namespace gtk_util
OLDNEW
« no previous file with comments | « chrome/common/gtk_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698