[gnome-maps] Hide route on invalid query
- From: Jonas Danielsson <jonasdn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] Hide route on invalid query
- Date: Fri, 12 Sep 2014 18:18:26 +0000 (UTC)
commit 5ac8c23104776217c76d2880037196cd742f85b0
Author: Jonas Danielsson <jonas danielsson threetimestwo org>
Date: Wed Sep 10 01:56:55 2014 -0400
Hide route on invalid query
When we do not have enough information to show
a route, we should not show anything.
https://bugzilla.gnome.org/show_bug.cgi?id=736347
src/mapView.js | 11 +++++++++--
src/sidebar.js | 8 +++++---
2 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/mapView.js b/src/mapView.js
index c668dfd..1396767 100644
--- a/src/mapView.js
+++ b/src/mapView.js
@@ -88,7 +88,7 @@ const MapView = new Lang.Class({
Application.geoclue.connect("location-changed",
this._updateUserLocation.bind(this));
- this._connectRouteSignals(Application.routeService.route);
+ this._connectRouteSignals();
},
_initView: function() {
@@ -130,13 +130,19 @@ const MapView = new Lang.Class({
this.view.add_layer(this._userLocationLayer);
},
- _connectRouteSignals: function(route) {
+ _connectRouteSignals: function() {
+ let route = Application.routeService.route;
+ let query = Application.routeService.query;
+
route.connect('update', this.showRoute.bind(this, route));
route.connect('reset', (function() {
this._routeLayer.remove_all();
this._instructionMarkerLayer.remove_all();
}).bind(this));
+ query.connect('notify', (function() {
+ this.routeVisible = query.isValid();
+ }).bind(this));
},
setMapType: function(mapType) {
@@ -205,6 +211,7 @@ const MapView = new Lang.Class({
showRoute: function(route) {
this._routeLayer.remove_all();
+ this.routeVisible = true;
route.path.forEach(this._routeLayer.add_node.bind(this._routeLayer));
diff --git a/src/sidebar.js b/src/sidebar.js
index 7e6d356..fad8194 100644
--- a/src/sidebar.js
+++ b/src/sidebar.js
@@ -169,14 +169,13 @@ const Sidebar = new Lang.Class({
query.removePoint(row.get_index() + 1);
row.destroy();
}).bind(this));
-
- this._timeInfo.label = '';
- this._distanceInfo.label = '';
}).bind(this));
query.connect('notify', (function() {
if (query.isValid())
this._instructionStack.visible_child = this._instructionSpinner;
+ else
+ this._clearInstructions();
}).bind(this));
route.connect('update', (function() {
@@ -203,6 +202,9 @@ const Sidebar = new Lang.Class({
_clearInstructions: function() {
let listBox = this._instructionList;
listBox.forall(listBox.remove.bind(listBox));
+
+ this._timeInfo.label = '';
+ this._distanceInfo.label = '';
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]