summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2021-04-06 22:20:58 +0200
committerMarcus Lundblad <ml@update.uu.se>2021-04-20 21:50:24 +0200
commit5fcda8977cce68d8c16775f912e41ce030899c09 (patch)
treeb67191f5ab563923787943fe351495b7aaa8f55d
parent70b25043d034fbc8dfc0969070c7843e92c017f2 (diff)
downloadgnome-maps-wip/mlundblad/additional-place-icons.tar.gz
storedRoute: Implement icon name methodwip/mlundblad/additional-place-icons
Instead of creating the Gio.Icon, just implement the _getIconName() method from Place and let the icon() getter in Place handle the task of creating the icon instance.
-rw-r--r--src/storedRoute.js31
1 files changed, 11 insertions, 20 deletions
diff --git a/src/storedRoute.js b/src/storedRoute.js
index 784c6693..04763097 100644
--- a/src/storedRoute.js
+++ b/src/storedRoute.js
@@ -21,7 +21,6 @@
*/
const Champlain = imports.gi.Champlain;
-const Gio = imports.gi.Gio;
const GObject = imports.gi.GObject;
const Gtk = imports.gi.Gtk;
@@ -89,25 +88,6 @@ class StoredRoute extends Place.Place {
return this._transportation;
}
- get icon() {
- let transport = RouteQuery.Transportation;
- let icon = Gio.Icon.new_for_string('route-button-symbolic');
-
- switch(this._transportation) {
- case transport.PEDESTRIAN:
- icon = Gio.Icon.new_for_string('route-pedestrian-symbolic');
- break;
- case transport.CAR:
- icon = Gio.Icon.new_for_string('route-car-symbolic');
- break;
- case transport.BIKE:
- icon = Gio.Icon.new_for_string('route-bike-symbolic');
- break;
- }
-
- return icon;
- }
-
get uniqueID() {
return this._transportation + '-' + this.places.map(function(place) {
return [place.osm_type, place.osm_id].join('-');
@@ -130,6 +110,17 @@ class StoredRoute extends Place.Place {
return hasNull;
}
+ _getIconName() {
+ let transport = RouteQuery.Transportation;
+
+ switch (this._transportation) {
+ case transport.PEDESTRIAN: return 'route-pedestrian-symbolic';
+ case transport.BIKE: return 'route-bike-symbolic';
+ case transport.CAR: return 'route-car-symbolic';
+ default: return 'route-button-symbolic';
+ }
+ }
+
toJSON() {
let turnPoints = this.route.turnPoints.map(function(turnPoint) {
let coordinate = { latitude: turnPoint.coordinate.latitude,