[gnome-maps/wip/mattiasb/templates: 6/10] MainWindow: Use params pattern for _init



commit b86a50e4ad3c5ee2dc9af4d604c2f3aa8d250b22
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Tue Mar 24 01:30:18 2015 +0100

    MainWindow: Use params pattern for _init
    
    This makes MainWindow consistent with most other classes in Maps.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=740647

 src/application.js |    3 ++-
 src/mainWindow.js  |   12 ++++++------
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 75a87ec..ab3b36d 100644
--- a/src/application.js
+++ b/src/application.js
@@ -213,7 +213,8 @@ const Application = new Lang.Class({
                                                                              'icons']));
         let overlay = new Gtk.Overlay({ visible: true, can_focus: false });
         notificationManager = new NotificationManager.NotificationManager(overlay);
-        this._mainWindow = new MainWindow.MainWindow(this, overlay);
+        this._mainWindow = new MainWindow.MainWindow({ application: this,
+                                                       overlay: overlay });
         this._mainWindow.connect('destroy', this._onWindowDestroy.bind(this));
     },
 
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 98a2e06..2f8126d 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -59,16 +59,16 @@ const MainWindow = new Lang.Class({
                         'layersButton',
                         'favoritesButton' ],
 
-    _init: function(app, overlay) {
-        this.parent();
+    _init: function(params) {
+        this._overlay = params.overlay;
+        delete params.overlay;
 
-        this._configureId = 0;
+        this.parent(params);
 
-        this.application = app;
-        this._overlay = overlay;
+        this._configureId = 0;
 
         this.mapView = new MapView.MapView();
-        overlay.add(this.mapView);
+        this._overlay.add(this.mapView);
 
         this.mapView.gotoUserLocation(false);
 


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