[gnome-maps/wip/mattiasb/templates] ContextMenu: Use params pattern



commit 14fc83415f46d80a577280b4902e9a9b3befafd8
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Tue Mar 24 01:56:24 2015 +0100

    ContextMenu: Use params pattern
    
    This makes ContextMenu consistent with most other classes in Maps.

 src/contextMenu.js |    8 +++++---
 src/mainWindow.js  |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 295d427..a90bd49 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -35,9 +35,11 @@ const ContextMenu = new Lang.Class({
     Template: 'resource:///org/gnome/Maps/ui/context-menu.ui',
     InternalChildren: [ 'whatsHereItem' ],
 
-    _init: function(mapView) {
-        this._mapView = mapView;
-        this.parent();
+    _init: function(params) {
+        this._mapView = params.mapView;
+        delete params.mapView;
+
+        this.parent(params);
 
         this._mapView.view.connect('button-release-event',
                                    this._onButtonReleaseEvent.bind(this));
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 56bc058..96a11b3 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -78,7 +78,7 @@ const MainWindow = new Lang.Class({
 
         this._sidebar = this._createSidebar();
 
-        this._contextMenu = new ContextMenu.ContextMenu(this._mapView);
+        this._contextMenu = new ContextMenu.ContextMenu({ mapView: this._mapView });
 
         this._layersButton.popover = new LayersPopover.LayersPopover();
         this._favoritesButton.popover = new FavoritesPopover.FavoritesPopover({ mapView: this._mapView });


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