diff options
author | Christopher Davis <christopherdavis@gnome.org> | 2021-09-22 00:40:49 -0700 |
---|---|---|
committer | Christopher Davis <christopherdavis@gnome.org> | 2021-09-22 02:08:38 -0700 |
commit | 1dcc77e4de7c163c659bf6c34167d53f212aedad (patch) | |
tree | a5b44a9842c4ae186f141034936654ff0f82c41e | |
parent | 959ef4b4768d6a192f715115029dd3d15d40069f (diff) | |
download | baobab-wip/cdavis/menu-to-popover.tar.gz |
chart: Use Popover instead of GtkMenuwip/cdavis/menu-to-popover
GtkMenu is gone in GTK4.
-rw-r--r-- | src/baobab-chart.vala | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala index b02290f..6616b6c 100644 --- a/src/baobab-chart.vala +++ b/src/baobab-chart.vala @@ -59,7 +59,7 @@ namespace Baobab { bool model_changed; - Gtk.Menu context_menu = null; + Gtk.Popover context_menu = null; Gtk.EventControllerScroll scroll_controller; Gtk.EventControllerMotion motion_controller; @@ -555,8 +555,7 @@ namespace Baobab { void build_context_menu () { var menu_model = Application.get_default ().get_menu_by_id ("chartmenu"); - context_menu = new Gtk.Menu.from_model (menu_model); - context_menu.attach_to_widget (this, null); + context_menu = new Gtk.Popover.from_model (this, menu_model); } void show_popup_menu (Gdk.EventButton? event) { @@ -576,7 +575,9 @@ namespace Baobab { action = action_group.lookup_action ("zoom-out") as SimpleAction; action.set_enabled (can_zoom_out ()); - context_menu.popup_at_pointer (event); + Gdk.Rectangle rect = { (int) event.x, (int) event.y, 0, 0 }; + context_menu.set_pointing_to (rect); + context_menu.popup (); } void connect_model_signals (Gtk.TreeModel m) { |