[gnome-maps/wip/user-location-toggle] mainWindow: Persistent state of user tracking toggle
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/user-location-toggle] mainWindow: Persistent state of user tracking toggle
- Date: Tue, 16 Apr 2013 01:23:53 +0000 (UTC)
commit a42238e350e897942e60914a59570aa9dc24226a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Tue Apr 16 04:21:57 2013 +0300
mainWindow: Persistent state of user tracking toggle
Remember state of the user location toggle button in dconf.
data/org.gnome.maps.gschema.xml.in | 5 +++++
src/mainWindow.js | 11 +++++++++--
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/data/org.gnome.maps.gschema.xml.in b/data/org.gnome.maps.gschema.xml.in
index 2ac23bf..b575c15 100644
--- a/data/org.gnome.maps.gschema.xml.in
+++ b/data/org.gnome.maps.gschema.xml.in
@@ -25,5 +25,10 @@
<_summary>Description of last known location</_summary>
<_description>Description of last known location of user.</_description>
</key>
+ <key name="track-user-location" type="b">
+ <default>false</default>
+ <_summary>Track user location</_summary>
+ <_description>Track user location.</_description>
+ </key>
</schema>
</schemalist>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index e00a353..a3b0bcd 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -96,17 +96,24 @@ const MainWindow = new Lang.Class({
let headerBar = new Gd.HeaderBar();
headerBar.set_custom_title(this._searchEntry);
- let toggle = new Gd.HeaderToggleButton({ symbolic_icon_name: 'find-location-symbolic' });
+ this.mapView = new MapView.MapView();
+
+ let trackUserLocation = Application.settings.get_boolean('track-user-location');
+ if (trackUserLocation)
+ this.mapView.gotoUserLocation(false);
+
+ let toggle = new Gd.HeaderToggleButton({ symbolic_icon_name: 'find-location-symbolic',
+ active: trackUserLocation });
toggle.connect('toggled', Lang.bind(this,
function() {
if (toggle.active)
this.mapView.gotoUserLocation(true);
+ Application.settings.set_boolean('track-user-location', toggle.active);
}));
headerBar.pack_start(toggle);
grid.add(headerBar);
- this.mapView = new MapView.MapView();
grid.add(this.mapView);
grid.show_all();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]