[gnome-maps/wip/jonasdn/mapbox-3-16: 3/5] Add Mapbox attribution logo



commit 2977a2ad818ff941606ff77eeac6ef3e4a8c96a9
Author: Jonas Danielsson <jonas threetimestwo org>
Date:   Sat Jul 30 15:20:35 2016 +0200

    Add Mapbox attribution logo

 data/media/mapbox-attribution-logo.svg |    1 +
 data/org.gnome.Maps.data.gresource.xml |    2 ++
 data/ui/attribution-logo.ui            |   12 ++++++++++++
 src/mainWindow.js                      |    3 +++
 src/mapSource.js                       |   11 +++++++++++
 5 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/data/media/mapbox-attribution-logo.svg b/data/media/mapbox-attribution-logo.svg
new file mode 100644
index 0000000..f6edd35
--- /dev/null
+++ b/data/media/mapbox-attribution-logo.svg
@@ -0,0 +1 @@
+<svg xmlns:dc="http://purl.org/dc/elements/1.1/"; xmlns:cc="http://creativecommons.org/ns#"; 
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"; xmlns:svg="http://www.w3.org/2000/svg"; 
xmlns="http://www.w3.org/2000/svg"; version="1.1" width="65" height="20"><defs/><metadata><rdf:RDF><cc:Work 
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type 
rdf:resource="http://purl.org/dc/dcmitype/StillImage"/><dc:title/></cc:Work></rdf:RDF></metadata><g 
transform="translate(-261.8483,-98.50395)"><g 
transform="matrix(0.17441836,0,0,0.17441836,220.52282,29.229342)" 
style="opacity:0.25;fill:#ffffff;stroke:#000000;stroke-width:17.20002365;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"><path
 d="M 5.28 1.5 C 4.54 1.56 3.9 2.25 3.91 3 l 0 11.88 c 0.02 0.77 0.72 1.47 1.5 1.47 l 1.75 0 c 0.78 0 1.48 
-0.69 1.5 -1.47 l 0 -4.28 0.72 1.19 c 0.53 0.87 2.03 0.87 2.56 0 l 0.72 -1.19 0 4.28 c 0.02 0.76 0.7 1.45 
1.47 1.47 l 1.75 0 c 0.78 0 1.48
  -0.69 1.5 -1.47 l 0 -0.16 c 1.02 1.12 2.46 1.81 4.09 1.81 l 4.09 0 0 1.47 c -0 0.78 0.69 1.48 1.47 1.5 l 
1.75 0 c 0.79 -0 1.5 -0.71 1.5 -1.5 l 0.02 -1.47 c 1.72 0 3.08 -0.64 4.14 -1.69 l 0 0.19 c 0 0.39 0.16 0.79 
0.44 1.06 0.28 0.28 0.67 0.44 1.06 0.44 l 3.31 0 c 2.03 0 3.85 -1.06 4.91 -2.69 1.05 1.61 2.84 2.69 4.88 2.69 
1.03 0 1.98 -0.27 2.81 -0.75 0.28 0.35 0.73 0.57 1.19 0.56 l 2.12 0 c 0.48 0.01 0.97 -0.23 1.25 -0.62 l 0.91 
-1.28 0.91 1.28 c 0.28 0.39 0.74 0.63 1.22 0.62 l 2.16 0 C 62.67 16.33 63.42 14.89 62.81 14 L 60.22 10.38 
62.62 7 C 63.26 6.11 62.5 4.62 61.41 4.62 l -2.16 0 C 58.78 4.62 58.31 4.86 58.03 5.25 L 57.31 6.28 56.56 
5.25 C 56.29 4.86 55.82 4.62 55.34 4.62 l -2.16 0 c -0.49 -0 -0.97 0.25 -1.25 0.66 -0.86 -0.51 -1.84 -0.81 
-2.91 -0.81 -2.03 0 -3.83 1.08 -4.88 2.69 C 43.1 5.53 41.27 4.47 39.19 4.47 L 39.19 3 C 39.19 2.61 39.03 2.21 
38.75 1.94 38.47 1.66 38.08 1.5 37.69 1.5 l -1.75 0 c -0.71 0 -1.5 0.83 -1.5 1.5 l 0 3.16 C 33.38 5.1 31.96 
4.47 30.38 4.47 l -
 3.34 0 c -0.77 0.02 -1.47 0.72 -1.47 1.5 l 0 0.31 c -1.02 -1.12 -2.46 -1.81 -4.09 -1.81 -1.63 0 -3.07 0.7 
-4.09 1.81 L 17.38 3 c -0 -0.79 -0.71 -1.5 -1.5 -1.5 L 14.5 1.5 C 13.55 1.5 12.28 1.87 11.66 2.94 l -1 1.69 
-1 -1.69 C 9.03 1.87 7.77 1.5 6.81 1.5 l -1.41 0 C 5.36 1.5 5.32 1.5 5.28 1.5 z m 16.19 7.72 c 0.53 0 0.94 
0.35 0.94 1.28 l 0 1.28 -0.94 0 c -0.52 0 -0.94 -0.38 -0.94 -1.28 -0 -0.9 0.42 -1.28 0.94 -1.28 z m 8.81 0 c 
0.83 0 1.18 0.68 1.19 1.28 0.01 0.94 -0.62 1.28 -1.19 1.28 z m 8.72 0 c 0.72 0 1.37 0.6 1.37 1.28 0 0.77 
-0.51 1.28 -1.37 1.28 z m 10.03 0 c 0.58 0 1.09 0.5 1.09 1.28 0 0.78 -0.51 1.28 -1.09 1.28 -0.58 0 -1.12 -0.5 
-1.12 -1.28 0 -0.78 0.54 -1.28 1.12 -1.28 z" transform="matrix(5.7333414,0,0,5.7333414,236.93308,397.17498)" 
style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;d
 
irection:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:17.20002365;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"/></g><g
 transform="matrix(0.17441836,0,0,0.17441836,220.52282,29.229342)" style="fill:#ffffff"><path d="m 5.41 3 0 
12 1.75 0 0 -9.91 3.5 5.94 3.47 -5.94 0 9.91 1.75 0 0 -12 L 14.5 3 C 13.8 3 13.25 3.16 12.94 3.69 L 10.66 
7.59 8.38 3.69 C 8.07 3.16 7.51 3 6.81 3 z M 36 3 l 0 12.03 3.25 0 c 2.44 0 4.38 -1.91 4.38 -4.53 0 -2.62 
-1.93 -4.47 -4.38 -4.47 C 38.7 6.03 38.32 6 37.75 6 l 0 -3 z M 21.47 5.97 c -2.44 0 -4.19 1.91 -4.19 4.53 0 
2.62 1.75 4.53 4.19 4.53 l 4.19 0 0 -4.53 c 0 -2.62 -1.75 -4.53 -4.19 -4.53 z m 27.56 0 c -2.41 0 -4.38 2.03 
-4.38 4.53 0 2.5 1.97 4.53 4.38 4.53 2.41 0 4.34 -2.03 4.34 -4.53 0 -2.5 -1.94 -4.53 -4.34 -4.53 z m -22 0.03
  0 12 1.75 0 0 -2.97 c 0.57 0 1.04 -0 1.59 0 2.44 0 4.34 -1.91 4.34 -4.53 0 -2.62 -1.9 -4.5 -4.34 -4.5 z m 
26.16 0 3.03 4.38 -3.19 4.62 2.12 0 L 57.31 11.91 59.44 15 61.59 15 58.38 10.38 61.41 6 59.25 6 57.31 8.81 
55.34 6 z M 21.47 7.72 c 1.4 0 2.44 1.19 2.44 2.78 l 0 2.78 -2.44 0 c -1.4 0 -2.44 -1.21 -2.44 -2.78 -0 -1.57 
1.04 -2.78 2.44 -2.78 z m 27.56 0 c 1.44 0 2.59 1.24 2.59 2.78 0 1.54 -1.15 2.78 -2.59 2.78 -1.44 0 -2.62 
-1.24 -2.62 -2.78 0 -1.54 1.18 -2.78 2.62 -2.78 z m -20.25 0.03 1.59 0 c 1.59 0 2.59 1.28 2.59 2.75 0 1.47 
-1.13 2.78 -2.59 2.78 l -1.59 0 z m 8.97 0 1.5 0 c 1.47 0 2.62 1.28 2.62 2.75 0 1.47 -1.04 2.78 -2.62 2.78 l 
-1.5 0 z" transform="matrix(5.7333414,0,0,5.7333414,236.93308,397.17498)" 
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"/></g></g></svg>
\ No newline at end of file
diff --git a/data/org.gnome.Maps.data.gresource.xml b/data/org.gnome.Maps.data.gresource.xml
index d775af4..f3e195d 100644
--- a/data/org.gnome.Maps.data.gresource.xml
+++ b/data/org.gnome.Maps.data.gresource.xml
@@ -3,6 +3,7 @@
   <gresource prefix="/org/gnome/Maps">
     <file preprocess="xml-stripblanks">ui/account-row.ui</file>
     <file preprocess="xml-stripblanks">ui/app-menu.ui</file>
+    <file preprocess="xml-stripblanks">ui/attribution-logo.ui</file>
     <file preprocess="xml-stripblanks">ui/busy-marker.ui</file>
     <file preprocess="xml-stripblanks">ui/check-in-dialog.ui</file>
     <file preprocess="xml-stripblanks">ui/context-menu.ui</file>
@@ -26,5 +27,6 @@
     <file alias="application.css">gnome-maps.css</file>
     <file alias="ui/maptype-aerial.png">media/maptype-aerial.png</file>
     <file alias="ui/maptype-street.png">media/maptype-street.png</file>
+    <file alias="ui/attribution.svg">media/mapbox-attribution-logo.svg</file>
   </gresource>
 </gresources>
diff --git a/data/ui/attribution-logo.ui b/data/ui/attribution-logo.ui
new file mode 100644
index 0000000..309620e
--- /dev/null
+++ b/data/ui/attribution-logo.ui
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 3.10 -->
+  <template class="Gjs_AttributionLogo" parent="GtkImage">
+    <property name="halign">end</property>
+    <property name="valign">end</property>
+    <property name="margin_bottom">6</property>
+    <property name="margin_end">6</property>
+    <property name="visible">true</property>
+    <property name="resource">/org/gnome/Maps/ui/attribution.svg</property>
+  </template>
+</interface>
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 98a500e..44341b6 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -34,6 +34,7 @@ const FavoritesPopover = imports.favoritesPopover;
 const Geoclue = imports.geoclue;
 const LayersPopover = imports.layersPopover;
 const LocationServiceNotification = imports.locationServiceNotification;
+const MapSource = imports.mapSource;
 const MapView = imports.mapView;
 const PlaceEntry = imports.placeEntry;
 const PlaceStore = imports.placeStore;
@@ -66,6 +67,8 @@ const MainWindow = new Lang.Class({
         this.mapView = new MapView.MapView();
         overlay.add(this.mapView);
 
+        overlay.add_overlay(new MapSource.AttributionLogo());
+
         this.mapView.gotoUserLocation(false);
 
         this._sidebar = this._createSidebar();
diff --git a/src/mapSource.js b/src/mapSource.js
index 7ab24fa..43a5ba8 100644
--- a/src/mapSource.js
+++ b/src/mapSource.js
@@ -18,6 +18,7 @@
  */
 
 const Champlain = imports.gi.Champlain;
+const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 
 const Utils = imports.utils;
@@ -40,6 +41,16 @@ const _MAX_ZOOM = 19;
 const _FILE_CACHE_SIZE_LIMIT = (10 * 1024 * 1024); /* 10Mb */
 const _MEMORY_CACHE_SIZE_LIMIT = 100; /* number of tiles */
 
+const AttributionLogo = new Lang.Class({
+    Name: 'AttributionLogo',
+    Extends: Gtk.Image,
+    Template: 'resource:///org/gnome/Maps/ui/attribution-logo.ui',
+
+    _init: function() {
+        this.parent();
+    }
+});
+
 function _createTileSource(uri, name) {
     return new Champlain.NetworkTileSource(
         { id: name,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]