File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -98,28 +98,27 @@ public class Music.TrackRow : Gtk.ListBoxRow {
9898 button = Gdk . BUTTON_SECONDARY
9999 };
100100 right_click. pressed. connect ((n_press, x, y) = > {
101- var rect = Gdk . Rectangle () {
102- x = (int ) x,
103- y = (int ) y
104- };
105- context_menu. pointing_to = rect;
106- context_menu. popup ();
101+ menu_popup_at_pointer (context_menu, x, y);
107102 });
108103
109104 var long_press = new Gtk .GestureLongPress ();
110105 long_press. pressed. connect ((x, y) = > {
111- var rect = Gdk . Rectangle () {
112- x = (int ) x,
113- y = (int ) y
114- };
115- context_menu. pointing_to = rect;
116- context_menu. popup ();
106+ menu_popup_at_pointer (context_menu, x, y);
117107 });
118108
119109 add_controller (right_click);
120110 add_controller (long_press);
121111 }
122112
113+ private void menu_popup_at_pointer (Gtk .PopoverMenu popover , double x , double y ) {
114+ var rect = Gdk . Rectangle () {
115+ x = (int ) x,
116+ y = (int ) y
117+ };
118+ popover. pointing_to = rect;
119+ popover. popup ();
120+ }
121+
123122 private void update_playing (bool playing ) {
124123 if (playing) {
125124 play_icon. add_css_class (" playing" );
You can’t perform that action at this time.
0 commit comments