diff options
author | Marcus Lundblad <ml@update.uu.se> | 2019-09-01 13:19:45 +0200 |
---|---|---|
committer | Marcus Lundblad <ml@update.uu.se> | 2019-09-19 21:44:57 +0200 |
commit | 6bd09a028386372208dae6b070a5730d9e92938f (patch) | |
tree | b1366196e9200021340793e2440a323a4cbce3ab | |
parent | d670a38c3201c47bedba782560e4597d4492b3d3 (diff) | |
download | gnome-maps-6bd09a028386372208dae6b070a5730d9e92938f.tar.gz |
sidebar: Update attribution
-rw-r--r-- | data/ui/sidebar.ui | 9 | ||||
-rw-r--r-- | src/sidebar.js | 24 |
2 files changed, 25 insertions, 8 deletions
diff --git a/data/ui/sidebar.ui b/data/ui/sidebar.ui index 015b907d..6b6707d3 100644 --- a/data/ui/sidebar.ui +++ b/data/ui/sidebar.ui @@ -292,16 +292,11 @@ <property name="visible">True</property> <property name="halign">GTK_ALIGN_END</property> <child> - <object class="GtkLinkButton"> - <property name="label" translatable="yes">Route search by OpenTripPlanner</property> + <object class="GtkLabel" id="transitAttributionLabel"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> - <property name="use_action_appearance">False</property> - <property name="relief">none</property> - <!-- opentripplanner.org uses an SSL cert only valid for github - domains... --> - <property name="uri">http://www.opentripplanner.org</property> + <property name="use_markup">True</property> <style> <class name="small-label"/> </style> diff --git a/src/sidebar.js b/src/sidebar.js index 2edc3243..32946654 100644 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -64,7 +64,8 @@ var Sidebar = GObject.registerClass({ 'transitItineraryListBox', 'transitItineraryBackButton', 'transitItineraryTimeLabel', - 'transitItineraryDurationLabel'] + 'transitItineraryDurationLabel', + 'transitAttributionLabel'] }, class Sidebar extends Gtk.Revealer { _init(mapView) { @@ -232,6 +233,7 @@ var Sidebar = GObject.registerClass({ /* don't remove query points as with the turn-based routing, * since we might get "no route" because of the time selected * and so on */ + this._transitAttributionLabel.label = ''; }); transitPlan.connect('no-more-results', () => { @@ -248,6 +250,7 @@ var Sidebar = GObject.registerClass({ if (this._query.transportation === RouteQuery.Transportation.TRANSIT) { this._clearTransitOverview(); this._showTransitOverview(); + this._transitAttributionLabel.label = ''; } else { this._clearInstructions(); } @@ -300,6 +303,7 @@ var Sidebar = GObject.registerClass({ }); transitPlan.connect('update', () => { + this._updateTransitAttribution(); this._clearTransitOverview(); this._showTransitOverview(); this._populateTransitItineraryOverview(); @@ -340,6 +344,24 @@ var Sidebar = GObject.registerClass({ listBox.forall(listBox.remove.bind(listBox)); } + _updateTransitAttribution() { + let plan = Application.routingDelegator.transitRouter.plan; + + if (plan.attribution) { + let attributionLabel = + _("Itineraries provided by %s").format(plan.attribution); + if (plan.attributionUrl) { + this._transitAttributionLabel.label = + '<a href="%s">%s</a>'.format([plan.attributionUrl], + attributionLabel); + } else { + this._transitAttributionLabel.label = attributionLabel; + } + } else { + this._transitAttributionLabel.label = ''; + } + } + _showTransitOverview() { let plan = Application.routingDelegator.transitRouter.plan; |