summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@dfupdate.se>2022-04-29 22:30:07 +0200
committerMarcus Lundblad <ml@dfupdate.se>2022-04-30 22:58:01 +0200
commitf2215b606f487e79fb3ccf975a85725b24111700 (patch)
tree021591a1b4a26cf4339209e2f5a51796e46869fc
parent0515f9d23daa73559c9563b2034e77901b82c656 (diff)
downloadgnome-maps-wip/mlundblad/remove-attribution-logo.tar.gz
mapSource: Remove attribution logo handlingwip/mlundblad/remove-attribution-logo
-rw-r--r--src/mapSource.js81
1 files changed, 0 insertions, 81 deletions
diff --git a/src/mapSource.js b/src/mapSource.js
index 5feb6298..dd25a6ce 100644
--- a/src/mapSource.js
+++ b/src/mapSource.js
@@ -18,93 +18,13 @@
*/
const Champlain = imports.gi.Champlain;
-const Clutter = imports.gi.Clutter;
-const GdkPixbuf = imports.gi.GdkPixbuf;
-const Gio = imports.gi.Gio;
-const GLib = imports.gi.GLib;
-const GObject = imports.gi.GObject;
-const Gtk = imports.gi.Gtk;
-const GtkClutter = imports.gi.GtkClutter;
-const System = imports.system;
const Service = imports.service;
const Utils = imports.utils;
-let _attributionImages = [];
-
const _FILE_CACHE_SIZE_LIMIT = (10 * 1024 * 1024); /* 10Mb */
const _MEMORY_CACHE_SIZE_LIMIT = 100; /* number of tiles */
-const _LOGO_PADDING_X = 10;
-const _LOGO_PADDING_Y = 25;
-// extra padding below logo in RTL, where scale will be on the right side
-const _LOGO_PADDING_Y_RTL = 35;
-
-var AttributionLogo = GObject.registerClass({},
-class AttributionLogo extends GtkClutter.Actor {
-
- _init(view) {
- super._init();
-
- this._view = view;
- this._rtl = Gtk.get_locale_direction() === Gtk.TextDirection.RTL;
- view.connect('notify::width', () => this._updatePosition());
- view.connect('notify::height', () => this._updatePosition());
-
- this._updatePosition(view);
- }
-
- setSource(source) {
- this._id = source.get_id();
-
- let bin = this.get_widget();
-
- if (bin.get_child())
- bin.remove(bin.get_child());
-
- if (_attributionImages[source.get_id()]) {
- bin.add(_attributionImages[source.get_id()]);
- bin.visible = true;
- } else {
- bin.visible = false;
- }
-
- this._updatePosition();
- }
-
- _updatePosition() {
- let image = _attributionImages[this._id];
-
- if (image) {
- let width = image.pixbuf.width;
- let height = image.pixbuf.height;
- let x = this._view.width - width - _LOGO_PADDING_X;
- /* TODO: ideally the attribution logo should be aligned to the left
- * side in RTL locales, but I couldn't get that working with Clutter
- * actor positioning, so adjust the padding to fit above the scale
- * for now
- */
- let y = this._view.height - height -
- (this._rtl ? _LOGO_PADDING_Y_RTL : _LOGO_PADDING_Y);
-
- this.set_position(x, y);
- }
- }
-});
-
-function _updateAttributionImage(source) {
- if (!source.attribution_logo || source.attribution_logo === "")
- return;
-
- if (!_attributionImages[source.id])
- _attributionImages[source.id] = new Gtk.Image({ visible: true });
-
- let data = GLib.base64_decode(source.attribution_logo);
- let stream = Gio.MemoryInputStream.new_from_bytes(GLib.Bytes.new(data));
- _attributionImages[source.id].pixbuf =
- GdkPixbuf.Pixbuf.new_from_stream(stream, null);
-}
-
function _createTileSource(source) {
let tileSource = new Champlain.NetworkTileSource({
id: source.id,
@@ -123,7 +43,6 @@ function _createTileSource(source) {
function _createCachedSource(source) {
let tileSource = _createTileSource(source);
- _updateAttributionImage(source);
let fileCache = new Champlain.FileCache({
size_limit: _FILE_CACHE_SIZE_LIMIT,