[gnome-maps/wip/mlundblad/local-tile-size-option: 1/2] application: Add command-line option for local tile size



commit afc39ece03d86f779d190355212379a85ed792f9
Author: Marcus Lundblad <ml update uu se>
Date:   Sat Apr 18 16:02:16 2020 +0200

    application: Add command-line option for local tile size
    
    Adds a command-line option --local-tile-size to
    override the default tile size value when using
    --local with a local tile set.

 src/application.js | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/src/application.js b/src/application.js
index a4bee15b..ab2252e6 100644
--- a/src/application.js
+++ b/src/application.js
@@ -93,6 +93,12 @@ var Application = GObject.registerClass({
                              GLib.OptionArg.FILENAME,
                              _("A path to a local tiles directory structure"),
                              null);
+        this.add_main_option('local-tile-size',
+                             0,
+                             GLib.OptionFlags.NONE,
+                             GLib.OptionArg.INT,
+                             _("Tile size for local tiles directory"),
+                             null);
 
         this.add_main_option('version', 'v'.charCodeAt(0), GLib.OptionFlags.NONE, GLib.OptionArg.NONE,
                              _("Show the version of the program"), null);
@@ -109,6 +115,10 @@ var Application = GObject.registerClass({
                 let variant = options.lookup_value('local', null);
                 this.local_tile_path = variant.deep_unpack();
                 normalStartup = false;
+                if (options.contains('local-tile-size')) {
+                    variant = options.lookup_value('local-tile-size', null);
+                    this.local_tile_size = variant.deep_unpack();
+                }
             } else if (options.contains('version')) {
                 print(pkg.version);
                 /* quit the invoked process after printing the version number


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