[gnome-maps] openTripPlanner: Don't reset later/earlier when no feasable itineraries
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps] openTripPlanner: Don't reset later/earlier when no feasable itineraries
- Date: Tue, 13 Jun 2017 19:06:14 +0000 (UTC)
commit 6147c4a42220d436fb2fbe9791d8f82f89ae105c
Author: Marcus Lundblad <ml update uu se>
Date: Sun Jun 11 21:26:08 2017 +0200
openTripPlanner: Don't reset later/earlier when no feasable itineraries
Also show the "No later/earlier alternatives" message instead of
resetting the search when the result list was pruned because the
additional itineraries where "disqualified" because of unrealistic
walking routes.
https://bugzilla.gnome.org/show_bug.cgi?id=783634
src/openTripPlanner.js | 34 +++++++++++++++++++++-------------
1 files changed, 21 insertions(+), 13 deletions(-)
---
diff --git a/src/openTripPlanner.js b/src/openTripPlanner.js
index 4ca0da9..6323bf4 100644
--- a/src/openTripPlanner.js
+++ b/src/openTripPlanner.js
@@ -598,6 +598,25 @@ const OpenTripPlanner = new Lang.Class({
this.plan.reset();
},
+ /* Indicate that no routes where found, either shows the "No route found"
+ * notification, or in case of loading additional (later/earlier) results,
+ * indicate no such where found, so that the sidebar can disable the
+ * "load more" functionallity as appropriate.
+ */
+ _noRouteFound: function() {
+ if (this._extendPrevious) {
+ let message = this._query.arriveBy ?
+ _("No earlier alternatives found.") :
+ _("No later alternatives found.");
+ Application.notificationManager.showMessage(message);
+ this._extendPrevious = false;
+ this.plan.noMoreResults();
+ } else {
+ Application.notificationManager.showMessage(_("No route found."));
+ this._reset();
+ }
+ },
+
_fetchRoute: function() {
this._fetchRouters((function(success) {
if (success) {
@@ -619,17 +638,7 @@ const OpenTripPlanner = new Lang.Class({
/* don't reset query points, unlike for turn-based
* routing, since options and timeing might influence
* results */
- if (this._extendPrevious) {
- let message = this._query.arriveBy ?
- _("No earlier alternatives found.") :
- _("No later alternatives found.");
- Application.notificationManager.showMessage(message);
- this._extendPrevious = false;
- this.plan.noMoreResults();
- } else {
- Application.notificationManager.showMessage(_("No route found."));
- this.plan.reset();
- }
+ this._noRouteFound();
} else {
this._recalculateItineraries(itineraries);
}
@@ -738,8 +747,7 @@ const OpenTripPlanner = new Lang.Class({
this._extendPrevious = false;
this.plan.update(newItineraries);
} else {
- Application.notificationManager.showMessage(_("No route found."));
- this._reset();
+ this._noRouteFound();
}
}
},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]