[gnome-maps] contextMenu: Stop using Gtk.Menu.popup()



commit 6970e5970bd5695ccb8e702e7c4234b24ff9497f
Author: Marcus Lundblad <ml update uu se>
Date:   Mon Jan 9 21:50:06 2017 +0100

    contextMenu: Stop using Gtk.Menu.popup()
    
    Instead of using the deprecated popup() function,
    use popup_at_pointer() and connect to the Gtk embed
    widget instead of the Clutter actor.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773631

 src/contextMenu.js |   15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index c399dd2..1941bb7 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -20,7 +20,6 @@
  */
 
 const Champlain = imports.gi.Champlain;
-const Clutter = imports.gi.Clutter;
 const Gdk = imports.gi.Gdk;
 const Geocode = imports.gi.GeocodeGlib;
 const Gtk = imports.gi.Gtk;
@@ -53,8 +52,8 @@ const ContextMenu = new Lang.Class({
 
         this.parent(params);
 
-        this._mapView.view.connect('button-release-event',
-                                   this._onButtonReleaseEvent.bind(this));
+        this._mapView.connect('button-release-event',
+                              this._onButtonReleaseEvent.bind(this));
 
         this._whatsHereItem.connect('activate',
                                     this._onWhatsHereActivated.bind(this));
@@ -72,16 +71,16 @@ const ContextMenu = new Lang.Class({
         this._routingUpdate();
     },
 
-    _onButtonReleaseEvent: function(actor, event) {
-        let button = event.get_button();
-        let [x, y] = event.get_coords();
+    _onButtonReleaseEvent: function(widget, event) {
+        let [_, button] = event.get_button();
+        let [_, x, y] = event.get_coords();
         this._longitude = this._mapView.view.x_to_longitude(x);
         this._latitude = this._mapView.view.y_to_latitude(y);
 
-        if (button === Clutter.BUTTON_SECONDARY) {
+        if (button === Gdk.BUTTON_SECONDARY) {
             Mainloop.idle_add((function() {
                 // Need idle to avoid Clutter dead-lock on re-entrance
-                this.popup(null, null, null, button, event.get_time());
+                this.popup_at_pointer(event);
             }).bind(this));
         }
     },


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]