[Xfce4-commits] <xfce4-notes-plugin:master> gtk3: Smaller icon buttons to fit better in the button frame
Mike Massonnet
noreply at xfce.org
Mon May 13 20:14:17 CEST 2013
Updating branch refs/heads/master
to 3b5e6b2d49e34c4889a3869e4960ce76da6e8477 (commit)
from 4cfd09b46a24ea468fcbe5b87c86126ef5a1ab01 (commit)
commit 3b5e6b2d49e34c4889a3869e4960ce76da6e8477
Author: Mike Massonnet <mmassonnet at gmail.com>
Date: Sun Mar 10 09:14:55 2013 +0100
gtk3: Smaller icon buttons to fit better in the button frame
lib/icon-button.vala | 21 +++++++++++++--------
1 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/lib/icon-button.vala b/lib/icon-button.vala
index 12e0d4f..07b6b14 100644
--- a/lib/icon-button.vala
+++ b/lib/icon-button.vala
@@ -47,13 +47,6 @@ namespace Xnp {
var style_context = get_style_context ();
if (sensitive && active) {
- int width = get_allocated_width ();
- int height = get_allocated_height ();
- style_context.save ();
- style_context.add_class (Gtk.STYLE_CLASS_BUTTON);
- style_context.render_frame (cr, 0, 0, width, height);
- style_context.render_background (cr, 0, 0, width, height);
- style_context.restore ();
Gdk.cairo_set_source_rgba (cr, style_context.get_color (Gtk.StateFlags.PRELIGHT));
}
else if (sensitive && !active)
@@ -78,7 +71,19 @@ namespace Xnp {
public override bool draw (Cairo.Context cr) {
int width = get_allocated_width ();
int height = get_allocated_height ();
- draw_icon (cr, width, 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);
+ style_context.render_background (cr, 0, 0, width, height);
+ style_context.restore ();
+
+ cr.save ();
+ cr.translate (2, 2);
+ draw_icon (cr, width - 4, height - 4);
+ cr.restore ();
+
return false;
}
#else
More information about the Xfce4-commits
mailing list