[seahorse] catalog: don't use deprecated Gtk.Menu.popup()
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse] catalog: don't use deprecated Gtk.Menu.popup()
- Date: Mon, 13 Aug 2018 20:44:18 +0000 (UTC)
commit aff8d432ed427c44f790229cc663d2e1a0001942
Author: Niels De Graef <nielsdegraef gmail com>
Date: Mon Aug 13 22:43:30 2018 +0200
catalog: don't use deprecated Gtk.Menu.popup()
common/catalog.vala | 27 +++++++++++----------------
pgp/seahorse-keyserver-results.c | 4 ++--
src/key-manager.vala | 4 ++--
3 files changed, 15 insertions(+), 20 deletions(-)
---
diff --git a/common/catalog.vala b/common/catalog.vala
index 44130ee0..62895129 100644
--- a/common/catalog.vala
+++ b/common/catalog.vala
@@ -193,22 +193,17 @@ public abstract class Catalog : Gtk.ApplicationWindow {
Viewable.view(obj, this);
}
- public void show_context_menu(string name,
- uint button,
- uint time)
- {
- var path = "/%s".printf(name);
- var menu = this._ui_manager.get_widget(path);
-
- if (menu == null)
- return;
- if (menu is Gtk.Menu) {
- ((Gtk.Menu)menu).popup(null, null, null, button, time);
- menu.show();
- } else {
- GLib.warning("the object /%s isn't a menu", name);
- }
- }
+ public void show_context_menu(string name, Gdk.Event? event) {
+ var widget = this._ui_manager.get_widget("/%s".printf(name));
+
+ Gtk.Menu? menu = widget as Gtk.Menu;
+ if (menu == null) {
+ warning("the object /%s isn't a menu", name);
+ return;
+ }
+ menu.popup_at_pointer(event);
+ menu.show();
+ }
private GLib.List<Gtk.ActionGroup> lookup_actions_for_objects (GLib.List<GLib.Object> objects) {
var table = new GLib.HashTable<Gtk.ActionGroup, weak Gtk.ActionGroup>(GLib.direct_hash,
GLib.direct_equal);
diff --git a/pgp/seahorse-keyserver-results.c b/pgp/seahorse-keyserver-results.c
index 0bf404d9..eee6a2c1 100644
--- a/pgp/seahorse-keyserver-results.c
+++ b/pgp/seahorse-keyserver-results.c
@@ -109,7 +109,7 @@ on_key_list_button_pressed (GtkTreeView* view, GdkEventButton* event, SeahorseKe
if (event->button == 3)
seahorse_catalog_show_context_menu (SEAHORSE_CATALOG (self),
SEAHORSE_CATALOG_MENU_OBJECT,
- event->button, event->time);
+ event);
return FALSE;
}
@@ -125,7 +125,7 @@ on_key_list_popup_menu (GtkTreeView* view, SeahorseKeyserverResults* self)
if (objects != NULL)
seahorse_catalog_show_context_menu (SEAHORSE_CATALOG (self),
SEAHORSE_CATALOG_MENU_OBJECT,
- 0, gtk_get_current_event_time ());
+ NULL);
g_list_free (objects);
return TRUE;
}
diff --git a/src/key-manager.vala b/src/key-manager.vala
index e4710ebd..9768b8cc 100644
--- a/src/key-manager.vala
+++ b/src/key-manager.vala
@@ -195,7 +195,7 @@ public class Seahorse.KeyManager : Catalog {
private bool on_keymanager_key_list_button_pressed(Gdk.EventButton event) {
if (event.button == 3)
- show_context_menu(Catalog.MENU_OBJECT, event.button, event.time);
+ show_context_menu(Catalog.MENU_OBJECT, event);
return false;
}
@@ -203,7 +203,7 @@ public class Seahorse.KeyManager : Catalog {
private bool on_keymanager_key_list_popup_menu() {
GLib.List<GLib.Object> objects = get_selected_objects();
if (objects != null)
- show_context_menu(Catalog.MENU_OBJECT, 0, Gtk.get_current_event_time());
+ show_context_menu(Catalog.MENU_OBJECT, null);
return false;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]