summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Davis <christopherdavis@gnome.org>2021-09-21 18:38:59 -0700
committerChristopher Davis <christopherdavis@gnome.org>2021-09-21 18:38:59 -0700
commitc1a019d31e8b51ddc760be20c7ce6ff7d6e953f9 (patch)
tree6be5ccefc8616bf01caf6643df145ff1213f8d4d
parenta23dab0f5d0ed3e5ab941017ec3f874137ccbc8e (diff)
downloadbaobab-c1a019d31e8b51ddc760be20c7ce6ff7d6e953f9.tar.gz
chart: Use EventControllerMotion
Replace the motion vfuncs with callbacks connected to the EventControllerMotion
-rw-r--r--src/baobab-chart.vala17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala
index 9702023..b02290f 100644
--- a/src/baobab-chart.vala
+++ b/src/baobab-chart.vala
@@ -62,6 +62,7 @@ namespace Baobab {
Gtk.Menu context_menu = null;
Gtk.EventControllerScroll scroll_controller;
+ Gtk.EventControllerMotion motion_controller;
List<ChartItem> items;
@@ -207,6 +208,10 @@ namespace Baobab {
scroll_controller = new Gtk.EventControllerScroll (this, Gtk.EventControllerScrollFlags.BOTH_AXES);
scroll_controller.scroll.connect (scroll_cb);
+ motion_controller = new Gtk.EventControllerMotion (this);
+ motion_controller.motion.connect (motion_cb);
+ motion_controller.leave.connect (leave_cb);
+
action_group = new SimpleActionGroup ();
action_group.add_action_entries (action_entries, this);
insert_action_group ("chart", action_group);
@@ -236,20 +241,14 @@ namespace Baobab {
return false;
}
- public override bool motion_notify_event (Gdk.EventMotion event) {
- has_tooltip = highlight_item_at_point (event.x, event.y);
-
- Gdk.Event.request_motions (event);
-
- return false;
+ void motion_cb (double x, double y) {
+ has_tooltip = highlight_item_at_point (x, y);
}
- public override bool leave_notify_event (Gdk.EventCrossing event) {
+ void leave_cb () {
if (!context_menu.visible) {
highlighted_item = null;
}
-
- return false;
}
unowned List<ChartItem> add_item (uint depth, double rel_start, double rel_size, Gtk.TreeIter iter) {