[gnome-maps] MainWindow: split out signal setup
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] MainWindow: split out signal setup
- Date: Wed, 31 Jul 2013 00:35:59 +0000 (UTC)
commit 51fc46b2f851e80b989ee445b9ff74fd76f3eef4
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date: Wed Jul 17 07:19:40 2013 +0200
MainWindow: split out signal setup
Split out signal connection setup into its own method, finally
making the _init of MainWindow reasonably short.
https://bugzilla.gnome.org/show_bug.cgi?id=704537
src/mainWindow.js | 50 ++++++++++++++++++++++++++------------------------
1 files changed, 26 insertions(+), 24 deletions(-)
---
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 14ed496..b0c1a0f 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -56,35 +56,14 @@ const MainWindow = new Lang.Class({
this.window = ui.appWindow;
this.window.application = app;
- this._initActions();
- this._restoreWindowGeometry();
-
- this.window.connect('delete-event',
- this._quit.bind(this));
- this.window.connect('configure-event',
- this._onConfigureEvent.bind(this));
- this.window.connect('window-state-event',
- this._onWindowStateEvent.bind(this));
-
- this._searchEntry.connect('activate', this._onSearchActivate.bind(this));
-
this.mapView = new MapView.MapView();
if(Application.settings.get_boolean('track-user-location'))
this.mapView.gotoUserLocation(false);
- this._viewMovedId = 0;
- this._connectMapMove();
- this.mapView.connect('going-to-user-location',
- this._disconnectMapMove.bind(this));
- this.mapView.connect('gone-to-user-location',
- this._connectMapMove.bind(this));
-
- Application.settings.connect('changed::track-user-location', (function() {
- if(Application.settings.get_boolean('track-user-location')) {
- this.mapView.gotoUserLocation(true);
- }
- }).bind(this));
+ this._initActions();
+ this._initSignals();
+ this._restoreWindowGeometry();
grid.add(this.mapView);
@@ -115,6 +94,29 @@ const MainWindow = new Lang.Class({
this.window.add_action(action);
},
+ _initSignals: function() {
+ this.window.connect('delete-event', this._quit.bind(this));
+ this.window.connect('configure-event',
+ this._onConfigureEvent.bind(this));
+ this.window.connect('window-state-event',
+ this._onWindowStateEvent.bind(this));
+
+ this._searchEntry.connect('activate',
+ this._onSearchActivate.bind(this));
+ this._viewMovedId = 0;
+ this._connectMapMove();
+ this.mapView.connect('going-to-user-location',
+ this._disconnectMapMove.bind(this));
+ this.mapView.connect('gone-to-user-location',
+ this._connectMapMove.bind(this));
+
+ Application.settings.connect('changed::track-user-location', (function() {
+ if(Application.settings.get_boolean('track-user-location')) {
+ this.mapView.gotoUserLocation(true);
+ }
+ }).bind(this));
+ },
+
_connectMapMove: function() {
if(this._viewMovedId === 0) {
this._viewMovedId = this.mapView.connect('view-moved', (function() {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]