summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Danielsson <jonas@threetimestwo.org>2016-02-24 09:43:39 +0100
committerJonas Danielsson <jonas@threetimestwo.org>2016-02-25 20:14:49 +0100
commit2dc4d8eea6f62e0744a57dcba1410e81d4dfee0b (patch)
tree7338c93909ff9fa9cbfb9e630b11dbf4e6438cbf
parentb8dfaabec9c036acb495bb622d7463eefaf23bcb (diff)
downloadgnome-maps-2dc4d8eea6f62e0744a57dcba1410e81d4dfee0b.tar.gz
instructionRow: Add property for colored icons
https://bugzilla.gnome.org/show_bug.cgi?id=762303
-rw-r--r--src/instructionRow.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/instructionRow.js b/src/instructionRow.js
index c91321ab..b0fcf200 100644
--- a/src/instructionRow.js
+++ b/src/instructionRow.js
@@ -36,10 +36,26 @@ const InstructionRow = new Lang.Class({
this.turnPoint = params.turnPoint;
delete params.turnPoint;
+ this._hasColor = params.hasColor;
+ delete params.hasColor;
+
this.parent(params);
this._instructionLabel.label = this.turnPoint.instruction;
- this._directionImage.icon_name = this.turnPoint.iconName;
+
+ /*
+ * The SVG icons for turn point stops has the color red, but has
+ * the suffix '-symbolic'. So when loading through GtkImage it will have
+ * the proper GtkIconLookupflags to re-color the icon as symbolic.
+ * When we load the PixBuf from the SVG ourself, we get the color.
+ */
+ if (this._hasColor) {
+ let theme = Gtk.IconTheme.get_default();
+ let iconName = this.turnPoint.iconName;
+ this._directionImage.pixbuf = theme.load_icon(iconName, 0, 0);
+ } else {
+ this._directionImage.icon_name = this.turnPoint.iconName;
+ }
if (this.turnPoint.distance > 0)
this._distanceLabel.label = Utils.prettyDistance(this.turnPoint.distance);