[Xfce4-commits] <xfce4-notes-plugin:master> gtk3: Keep style_context inside a single variable

Mike Massonnet noreply at xfce.org
Mon May 13 20:14:04 CEST 2013


Updating branch refs/heads/master
         to e3f1701009da8e5eeb247a985a63e7391e6baa3e (commit)
       from 7545a16d7fcd97dd308b2a3d5f986330b81003f5 (commit)

commit e3f1701009da8e5eeb247a985a63e7391e6baa3e
Author: Mike Massonnet <mmassonnet at gmail.com>
Date:   Fri Mar 1 10:11:59 2013 +0100

    gtk3: Keep style_context inside a single variable

 lib/icon-button.vala |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/icon-button.vala b/lib/icon-button.vala
index 5b7fb7f..12e0d4f 100644
--- a/lib/icon-button.vala
+++ b/lib/icon-button.vala
@@ -44,10 +44,11 @@ namespace Xnp {
 
 		protected void set_widget_source_color (Cairo.Context cr) {
 #if ENABLE_GTK3
+			var style_context = get_style_context ();
+
 			if (sensitive && active) {
 				int width = get_allocated_width ();
 				int height = get_allocated_height ();
-				var style_context = get_style_context ();
 				style_context.save ();
 				style_context.add_class (Gtk.STYLE_CLASS_BUTTON);
 				style_context.render_frame (cr, 0, 0, width, height);
@@ -56,9 +57,9 @@ namespace Xnp {
 				Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.PRELIGHT));
 			}
 			else if (sensitive && !active)
-				Gdk.cairo_set_source_rgba (cr, get_style_context ().get_color (Gtk.StateFlags.NORMAL));
+				Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.NORMAL));
 			else if (!sensitive)
-				Gdk.cairo_set_source_rgba (cr, get_style_context ().get_color (Gtk.StateFlags.INSENSITIVE));
+				Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.INSENSITIVE));
 #else
 			if (sensitive && active)
 				Gdk.cairo_set_source_color (cr, style.base[Gtk.StateType.NORMAL]);


More information about the Xfce4-commits mailing list