[gedit-plugins] terminal: no longer use gedit_utils_menu_position_under_widget()
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins] terminal: no longer use gedit_utils_menu_position_under_widget()
- Date: Tue, 19 Nov 2019 04:07:35 +0000 (UTC)
commit dc58985cea2075d824584d74266c06e2e8cd952a
Author: Sébastien Wilmet <swilmet gnome org>
Date: Tue Nov 19 04:36:12 2019 +0100
terminal: no longer use gedit_utils_menu_position_under_widget()
gedit_utils_menu_position_under_widget() and gtk_menu_popup() are
deprecated, so use gtk_menu_popup_at_pointer() and
gtk_menu_popup_at_widget() instead.
BTW, there was a runtime error with the lambda:
TypeError: <lambda>() takes 1 positional argument but 4 were given
The first case, with popup_at_pointer(), is triggerred with a
right-click event in the embedded terminal. The second case, with
popup_at_widget(), can be triggerred with the keyboard popup menu key.
For popup_at_widget(), the Gdk.Gravity values have been chosen because
the embedded terminal is located in the *bottom* panel of gedit, so it
makes more sense to show the popup menu just *above* the terminal, not
below.
plugins/terminal/terminal.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/plugins/terminal/terminal.py b/plugins/terminal/terminal.py
index 5f7ebb1..69f5f38 100644
--- a/plugins/terminal/terminal.py
+++ b/plugins/terminal/terminal.py
@@ -276,12 +276,12 @@ class GeditTerminalPanel(Gtk.Box):
menu.attach_to_widget(self, None)
if event is not None:
- menu.popup(None, None, None, None, event.button, event.time)
+ menu.popup_at_pointer(event)
else:
- menu.popup(None, None,
- lambda m: Gedit.utils_menu_position_under_widget(m, self),
- None,
- 0, Gtk.get_current_event_time())
+ menu.popup_at_widget(self,
+ Gdk.Gravity.NORTH_WEST,
+ Gdk.Gravity.SOUTH_WEST,
+ None)
menu.select_first(False)
def copy_clipboard(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]