From bedfb6dadf87ce5f5eee84c706c0246901f755c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alberts=20Muktup=C4=81vels?= Date: Thu, 19 Feb 2015 14:57:35 +0200 Subject: Add class name for toggle button Ported to ArcticaGreeter: Mike Gabriel --- src/flat-button.vala | 7 ------- src/toggle-box.vala | 5 +++++ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/flat-button.vala b/src/flat-button.vala index a81aebf..b56cc46 100644 --- a/src/flat-button.vala +++ b/src/flat-button.vala @@ -39,13 +39,6 @@ public class FlatButton : Gtk.Button } } - public override bool draw (Cairo.Context c) - { - // Make sure we don't react to mouse hovers - unset_state_flags (Gtk.StateFlags.PRELIGHT); - return base.draw (c); - } - public override bool button_press_event (Gdk.EventButton event) { // Do nothing. The normal handler sets priv->button_down which diff --git a/src/toggle-box.vala b/src/toggle-box.vala index f93cdea..f1ef8b3 100644 --- a/src/toggle-box.vala +++ b/src/toggle-box.vala @@ -66,15 +66,20 @@ public class ToggleBox : Gtk.Box private void select (Gtk.Button button) { if (selected_button != null) + { selected_button.relief = Gtk.ReliefStyle.NONE; + selected_button.get_style_context ().remove_class ("selected"); + } selected_button = button; selected_button.relief = Gtk.ReliefStyle.NORMAL; + selected_button.get_style_context ().add_class ("selected"); selected_key = selected_button.get_data ("toggle-list-key"); } private Gtk.Button make_button (string key, string name_in, Gdk.Pixbuf? icon) { var item = new FlatButton (); + item.get_style_context ().add_class ("toggle-button"); item.relief = Gtk.ReliefStyle.NONE; item.clicked.connect (button_clicked_cb); -- cgit v1.2.3