[gnome-maps/wip/gtk4-and-libshumate] WIP: Port to GTK 4 and libshumate




commit 814a8b2607cea6a48954d823d58387541dcb844c
Author: Marcus Lundblad <ml dfupdate se>
Date:   Thu Jun 30 23:11:19 2022 +0200

    WIP: Port to GTK 4 and libshumate

 lib/maps-file-tile-source.c | 280 +++++++++++++++++++++-----------------------
 lib/maps-file-tile-source.h |   8 +-
 lib/meson.build             |   4 +-
 meson.build                 |   6 +-
 org.gnome.Maps.json         |  46 +-------
 src/application.js          |  10 +-
 src/contextMenu.js          |   2 +-
 src/epaf.js                 |   4 +-
 src/graphHopperTransit.js   |  10 +-
 src/main.js                 |  12 +-
 src/mainWindow.js           |   2 +-
 src/storedRoute.js          |  10 +-
 12 files changed, 170 insertions(+), 224 deletions(-)
---
diff --git a/lib/maps-file-tile-source.c b/lib/maps-file-tile-source.c
index 61e5f060..340a9154 100644
--- a/lib/maps-file-tile-source.c
+++ b/lib/maps-file-tile-source.c
@@ -17,7 +17,7 @@
  * Author: Jonas Danielsson <jonas threetimestwo org>
  */
 
-#include <champlain/champlain.h>
+#include <shumate/shumate.h>
 #include <gio/gio.h>
 #include <glib.h>
 #include <glib-object.h>
@@ -41,8 +41,10 @@ enum {
   PROP_PATH,
   PROP_MAX_ZOOM,
   PROP_MIN_ZOOM,
-  PROP_WORLD
-
+  PROP_WORLD_LEFT,
+  PROP_WORLD_TOP,
+  PROP_WORLD_RIGHT,
+  PROP_WORLD_BOTTOM
 };
 
 struct _MapsFileTileSourcePrivate
@@ -51,7 +53,10 @@ struct _MapsFileTileSourcePrivate
   gchar *extension;
   gint max_zoom;
   gint min_zoom;
-  ChamplainBoundingBox *world;
+  double world_left;
+  double world_top;
+  double world_right;
+  double world_bottom;
 
   long min_x;
   long min_y;
@@ -59,17 +64,7 @@ struct _MapsFileTileSourcePrivate
   long max_y;
 };
 
-typedef struct
-{
-  ChamplainMapSource *map_source;
-  ChamplainTile *tile;
-} CallbackData;
-
-G_DEFINE_TYPE_WITH_PRIVATE (MapsFileTileSource, maps_file_tile_source, CHAMPLAIN_TYPE_TILE_SOURCE)
-
-static void fill_tile (ChamplainMapSource *map_source,
-    ChamplainTile *tile);
-
+G_DEFINE_TYPE_WITH_PRIVATE (MapsFileTileSource, maps_file_tile_source, SHUMATE_TYPE_MAP_SOURCE)
 
 static void
 maps_file_tile_source_set_property (GObject      *object,
@@ -112,8 +107,20 @@ maps_file_tile_source_get_property (GObject *object,
       g_value_set_uint (value, tile_source->priv->max_zoom);
       break;
 
-    case PROP_WORLD:
-      g_value_set_boxed (value, tile_source->priv->world);
+    case PROP_WORLD_LEFT:
+      g_value_set_double (value, tile_source->priv->world_left);
+      break;
+
+    case PROP_WORLD_TOP:
+      g_value_set_double (value, tile_source->priv->world_top);
+      break;
+
+    case PROP_WORLD_RIGHT:
+      g_value_set_double (value, tile_source->priv->world_right);
+      break;
+
+    case PROP_WORLD_BOTTOM:
+      g_value_set_double (value, tile_source->priv->world_bottom);
       break;
 
     default:
@@ -142,7 +149,7 @@ maps_file_tile_source_finalize (GObject *object)
 }
 
 static guint
-get_max_zoom_level (ChamplainMapSource *source)
+get_max_zoom_level (ShumateMapSource *source)
 {
   MapsFileTileSource *tile_source = (MapsFileTileSource *) source;
 
@@ -150,17 +157,29 @@ get_max_zoom_level (ChamplainMapSource *source)
 }
 
 static guint
-get_min_zoom_level (ChamplainMapSource *source)
+get_min_zoom_level (ShumateMapSource *source)
 {
   MapsFileTileSource *tile_source = (MapsFileTileSource *) source;
 
   return tile_source->priv->min_zoom;
 }
 
+static void
+fill_tile_async (ShumateMapSource     *source,
+                 ShumateTile          *tile,
+                 GCancellable         *cancellable,
+                 GAsyncReadyCallback   callback,
+                 gpointer              user_data);
+
+static gboolean
+fill_tile_finish (ShumateMapSource *map_source,
+                  GAsyncResult *result,
+                  GError **error);
+
 static void
 maps_file_tile_source_class_init (MapsFileTileSourceClass *klass)
 {
-  ChamplainMapSourceClass *map_source_class = CHAMPLAIN_MAP_SOURCE_CLASS (klass);
+  ShumateMapSourceClass *map_source_class = SHUMATE_MAP_SOURCE_CLASS (klass);
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
   GParamSpec *pspec;
 
@@ -170,7 +189,9 @@ maps_file_tile_source_class_init (MapsFileTileSourceClass *klass)
   object_class->set_property = maps_file_tile_source_set_property;
   map_source_class->get_max_zoom_level = get_max_zoom_level;
   map_source_class->get_min_zoom_level = get_min_zoom_level;
-  map_source_class->fill_tile = fill_tile;
+  map_source_class->fill_tile_async = fill_tile_async;
+  // TODO: Getting "no such member file_tile_finish" here, not sure why...
+  //map_source_class->fill_tile_finish = fill_tile_finish;
 
   /**
    * MapsFileTileSource:path:
@@ -216,19 +237,59 @@ maps_file_tile_source_class_init (MapsFileTileSourceClass *klass)
   g_object_class_install_property (object_class, PROP_MAX_ZOOM, pspec);
 
   /**
-   * MapsFileTileSource:world:
+   * MapsFileTileSource:world_left:
    *
-   * Set a bounding box to limit the world to. No tiles will be loaded
-   * outside of this bounding box. It will not be possible to scroll outside
-   * of this bounding box.
+   * The leftmost of the world bounding box.
    *
    */
-  pspec = g_param_spec_boxed ("world",
-                              "The world",
-                              "The bounding box to limit the #ChamplainView to",
-                              CHAMPLAIN_TYPE_BOUNDING_BOX,
-                              G_PARAM_READABLE);
-  g_object_class_install_property (object_class, PROP_WORLD, pspec);
+  pspec = g_param_spec_double ("worl-left",
+                               "Boundingbox left",
+                               "The leftmost coordinate of the world boundingbox",
+                               -180,
+                               180,
+                               -180,
+                               G_PARAM_READABLE);
+
+  /**
+   * MapsFileTileSource:world_top:
+   *
+   * The top of the world bounding box.
+   *
+   */
+  pspec = g_param_spec_double ("worl-top",
+                               "Boundingbox top",
+                               "The topmost coordinate of the world boundingbox",
+                               -90,
+                               90,
+                               90,
+                               G_PARAM_READABLE);
+  /**
+   * MapsFileTileSource:world_right:
+   *
+   * The rightmost of the world bounding box.
+   *
+   */
+  pspec = g_param_spec_double ("worl-right",
+                               "Boundingbox right",
+                               "The rightmost coordinate of the world boundingbox",
+                               -180,
+                               180,
+                               180,
+                               G_PARAM_READABLE);
+
+  /**
+   * MapsFileTileSource:world_bottom:
+   *
+   * The bottommost of the world bounding box.
+   *
+   */
+  pspec = g_param_spec_double ("worl-bottom",
+                               "Boundingbox bottom",
+                               "The bottommost coordinate of the world boundingbox",
+                               -90,
+                               90,
+                               -90,
+                               G_PARAM_READABLE);
 }
 
 static void
@@ -239,11 +300,14 @@ maps_file_tile_source_init (MapsFileTileSource *tile_source)
   tile_source->priv->extension = NULL;
   tile_source->priv->max_zoom = -1;
   tile_source->priv->min_zoom = 21;
-  tile_source->priv->world = NULL;
   tile_source->priv->min_x = G_MAXLONG;
   tile_source->priv->min_y = G_MAXLONG;
   tile_source->priv->max_x = 0;
   tile_source->priv->max_y = 0;
+  tile_source->priv->world_left = -180;
+  tile_source->priv->world_top = 90;
+  tile_source->priv->world_right = 180;
+  tile_source->priv->world_bottom = -90;
 }
 
 static gboolean
@@ -474,9 +538,9 @@ maps_file_tile_source_prepare (MapsFileTileSource *tile_source,
   g_return_val_if_fail (MAPS_IS_FILE_TILE_SOURCE (tile_source), FALSE);
   g_return_val_if_fail (tile_source->priv->path != NULL, FALSE);
 
-  ChamplainMapSource *source = (ChamplainMapSource *) tile_source;
+  ShumateMapSource *source = (ShumateMapSource *) tile_source;
   gboolean ret = TRUE;
-  guint tile_size = champlain_map_source_get_tile_size (source);
+  guint tile_size = shumate_map_source_get_tile_size (source);
 
   if (!get_zoom_levels (tile_source, error)) {
     ret = FALSE;
@@ -488,20 +552,19 @@ maps_file_tile_source_prepare (MapsFileTileSource *tile_source,
     goto out;
   }
 
-  tile_source->priv->world = champlain_bounding_box_new ();
-  tile_source->priv->world->left = champlain_map_source_get_longitude (source,
+  tile_source->priv->world_left = shumate_map_source_get_longitude (source,
                                                     tile_source->priv->min_zoom,
                                                     tile_source->priv->min_x *
                                                     tile_size);
-  tile_source->priv->world->right = champlain_map_source_get_longitude (source,
+  tile_source->priv->world_right = shumate_map_source_get_longitude (source,
                                                      tile_source->priv->min_zoom,
                                                      (tile_source->priv->max_x + 1) *
                                                      tile_size);
-  tile_source->priv->world->top = champlain_map_source_get_latitude (source,
+  tile_source->priv->world_top = shumate_map_source_get_latitude (source,
                                                      tile_source->priv->min_zoom,
                                                      tile_source->priv->min_y *
                                                      tile_size);
-  tile_source->priv->world->bottom = champlain_map_source_get_latitude (source,
+  tile_source->priv->world_bottom = shumate_map_source_get_latitude (source,
                                                   tile_source->priv->min_zoom,
                                                   (tile_source->priv->max_y + 1) *
                                                   tile_size);
@@ -510,131 +573,56 @@ maps_file_tile_source_prepare (MapsFileTileSource *tile_source,
 }
 
 static void
-tile_rendered_cb (ChamplainTile    *tile,
-                  gpointer          data,
-                  guint             size,
-                  gboolean          error,
-                  CallbackData     *user_data)
-{
-  ChamplainMapSource *map_source = user_data->map_source;
-  ChamplainMapSource *next_source;
-
-  g_signal_handlers_disconnect_by_func (tile, tile_rendered_cb, user_data);
-  g_slice_free (CallbackData, user_data);
-
-  next_source = champlain_map_source_get_next_source (map_source);
-
-  if (!error)
-    {
-      ChamplainTileSource *tile_source = CHAMPLAIN_TILE_SOURCE (map_source);
-      ChamplainTileCache *tile_cache = champlain_tile_source_get_cache (tile_source);
-
-      if (tile_cache && data)
-        champlain_tile_cache_store_tile (tile_cache, tile, data, size);
-
-      champlain_tile_set_fade_in (tile, TRUE);
-      champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
-      champlain_tile_display_content (tile);
-    }
-  else if (next_source)
-    champlain_map_source_fill_tile (next_source, tile);
-
-  g_object_unref (map_source);
-  g_object_unref (tile);
-}
-
-static void
-tile_loaded_cb (GFile        *file,
-                GAsyncResult *res,
-                CallbackData *user_data)
+fill_tile_async (ShumateMapSource     *source,
+                 ShumateTile          *tile,
+                 GCancellable         *cancellable,
+                 GAsyncReadyCallback   callback,
+                 gpointer              user_data)
 {
-  ChamplainMapSource *map_source = user_data->map_source;
-  ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
-  ChamplainTile *tile = user_data->tile;
-  CallbackData *data;
-  ChamplainRenderer *renderer;
-  guint8 *content;
-  gsize length;
-
-  g_slice_free (CallbackData, user_data);
-
-  if (!g_file_load_contents_finish (file, res, (char **) &content, &length, NULL, NULL))
-    {
-      goto load_next;
-    }
-
-  renderer = champlain_map_source_get_renderer (map_source);
-  g_return_if_fail (CHAMPLAIN_IS_RENDERER (renderer));
-
-  data = g_slice_new (CallbackData);
-  data->map_source = map_source;
-
-  g_signal_connect (tile, "render-complete", G_CALLBACK (tile_rendered_cb), data);
-
-  champlain_renderer_set_data (renderer, content, length);
-  champlain_renderer_render (renderer, tile);
-
-  return;
-
-load_next:
-  if (next_source)
-    champlain_map_source_fill_tile (next_source, tile);
-
-  goto cleanup;
-
-  champlain_tile_set_fade_in (tile, TRUE);
-  champlain_tile_set_state (tile, CHAMPLAIN_STATE_DONE);
-  champlain_tile_display_content (tile);
+  g_return_if_fail (MAPS_IS_FILE_TILE_SOURCE (source));
 
-cleanup:
-  g_object_unref (tile);
-  g_object_unref (map_source);
-}
-
-static void
-fill_tile (ChamplainMapSource *map_source,
-           ChamplainTile      *tile)
-{
-  g_return_if_fail (MAPS_IS_FILE_TILE_SOURCE (map_source));
-  g_return_if_fail (CHAMPLAIN_IS_TILE (tile));
-
-  MapsFileTileSource *tile_source = MAPS_FILE_TILE_SOURCE (map_source);
-  CallbackData *callback_data;
+  MapsFileTileSource *tile_source = MAPS_FILE_TILE_SOURCE (source);
   GFile *file;
   gchar *path = NULL;
-
-  if (champlain_tile_get_state (tile) == CHAMPLAIN_STATE_DONE)
-    return;
+  g_autoptr(GTask) task = NULL;
 
   path = g_strdup_printf("%s/%d/%d/%d.%s",
                          tile_source->priv->path,
-                         champlain_tile_get_zoom_level (tile),
-                         champlain_tile_get_x (tile),
-                         champlain_tile_get_y (tile),
+                         shumate_tile_get_zoom_level (tile),
+                         shumate_tile_get_x (tile),
+                         shumate_tile_get_y (tile),
                          tile_source->priv->extension);
   file = g_file_new_for_path (path);
 
+  task = g_task_new (source, cancellable, callback, user_data);
+  g_task_set_source_tag (task, fill_tile_async);
+
   if (g_file_query_exists(file, NULL))
     {
-      callback_data = g_slice_new (CallbackData);
-      callback_data->tile = tile;
-      callback_data->map_source = map_source;
-
-      g_object_ref (map_source);
-      g_object_ref (tile);
-
       g_file_load_contents_async (file, NULL,
-                                  (GAsyncReadyCallback) tile_loaded_cb,
-                                  callback_data);
+                                  callback,
+                                  user_data);
+
+      g_task_return_boolean (task, TRUE);
     }
   else
     {
-      ChamplainMapSource *next_source = champlain_map_source_get_next_source (map_source);
-
-      if (CHAMPLAIN_IS_MAP_SOURCE (next_source))
-        champlain_map_source_fill_tile (next_source, tile);
+      g_task_return_boolean (task, FALSE);
     }
 
   g_object_unref (file);
   g_free (path);
 }
+
+static gboolean
+fill_tile_finish (ShumateMapSource *map_source,
+                                        GAsyncResult *result,
+                                        GError **error)
+{
+  MapsFileTileSource *self = (MapsFileTileSource *) map_source;
+
+  g_return_val_if_fail (MAPS_IS_FILE_TILE_SOURCE (self), FALSE);
+  g_return_val_if_fail (g_task_is_valid (result, self), FALSE);
+
+  return g_task_propagate_boolean (G_TASK (result), error);
+}
diff --git a/lib/maps-file-tile-source.h b/lib/maps-file-tile-source.h
index 9b432e04..f7c88e15 100644
--- a/lib/maps-file-tile-source.h
+++ b/lib/maps-file-tile-source.h
@@ -20,7 +20,7 @@
 #ifndef _MAPS_FILE_TILE_SOURCE_H_
 #define _MAPS_FILE_TILE_SOURCE_H_
 
-#include <champlain/champlain.h>
+#include <shumate/shumate.h>
 
 G_BEGIN_DECLS
 
@@ -55,19 +55,19 @@ typedef struct _MapsFileTileSourceClass MapsFileTileSourceClass;
  */
 struct _MapsFileTileSource
 {
-  ChamplainTileSource parent_instance;
+  ShumateMapSource parent_instance;
 
   MapsFileTileSourcePrivate *priv;
 };
 
 struct _MapsFileTileSourceClass
 {
-  ChamplainTileSourceClass parent_class;
+  ShumateMapSourceClass parent_class;
 };
 
 GType maps_file_tile_source_get_type (void);
 
-gboolean maps_file_tile_source_prepare (MapsFileTileSource *tile_source, GError **error);
+gboolean maps_file_tile_source_prepare (MapsFileTileSource *data_source, GError **error);
 G_END_DECLS
 
 #endif /* _MAPS_FILE_TILE_SOURCE_H_ */
diff --git a/lib/meson.build b/lib/meson.build
index 8de63691..86c83767 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -47,8 +47,8 @@ gnome.generate_gir(
        includes: [
                'GLib-2.0',
                'GObject-2.0',
-               'Champlain-0.12',
-               'Rest-0.7'
+               'Rest-0.7',
+               'Shumate-0.0'
        ],
        install: true,
        install_dir_gir: join_paths(pkgdatadir, 'gir-' + maps_gir_version),
diff --git a/meson.build b/meson.build
index a9e018f3..65db090c 100644
--- a/meson.build
+++ b/meson.build
@@ -34,13 +34,13 @@ glib = dependency('glib-2.0', version: '>= 2.66.0')
 gio = dependency('gio-2.0', version: '>= 2.44.0')
 gjs = dependency('gjs-1.0', version: '>= 1.69.2')
 girepository = dependency('gobject-introspection-1.0', version: '>= 0.10.1')
-gtk3 = dependency('gtk+-3.0', version: '>= 3.22.0')
+gtk4 = dependency('gtk4')
 geoclue2 = dependency('geoclue-2.0', version: '>= 0.12.99')
-handy = dependency('libhandy-1', version: '>= 1.5.0')
+libadwaita = dependency('libadwaita-1')
 gweather = dependency('gweather4', version: '>= 3.90.0')
 
 libmaps_deps = [
-       dependency('champlain-0.12', version: '>= 0.12.14'),
+       dependency('shumate-0.0'),
        dependency('libxml-2.0'),
        dependency('rest-0.7', version: '>= 0.7.90')
 ]
diff --git a/org.gnome.Maps.json b/org.gnome.Maps.json
index bb2e1196..085bd172 100644
--- a/org.gnome.Maps.json
+++ b/org.gnome.Maps.json
@@ -90,51 +90,17 @@
             ]
         },
         {
-            "name": "cogl",
-            "config-opts": [
-                "--disable-cogl-gst",
-                "--enable-xlib-egl-platform",
-                "--enable-wayland-egl-platform"
-            ],
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": "https://download.gnome.org/sources/cogl/1.22/cogl-1.22.8.tar.xz";,
-                    "sha256": "a805b2b019184710ff53d0496f9f0ce6dcca420c141a0f4f6fcc02131581d759"
-                }
-            ]
-        },
-        {
-            "name": "clutter",
+            "name" : "libshumate",
+            "buildsystem": "meson",
             "config-opts": [
-                "--enable-egl-backend",
-                "--enable-wayland-backend"
+                "-Ddemos=false",
+                "-Dgtk_doc=false",
+                "-Dvapi=false"
             ],
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": "https://download.gnome.org/sources/clutter/1.26/clutter-1.26.4.tar.xz";,
-                    "sha256": "8b48fac159843f556d0a6be3dbfc6b083fc6d9c58a20a49a6b4919ab4263c4e6"
-                }
-            ]
-        },
-        {
-            "name": "clutter-gtk",
-            "sources": [
-                {
-                    "type": "archive",
-                    "url": "https://download.gnome.org/sources/clutter-gtk/1.8/clutter-gtk-1.8.4.tar.xz";,
-                    "sha256": "521493ec038973c77edcb8bc5eac23eed41645117894aaee7300b2487cb42b06"
-                }
-            ]
-        },
-        {
-            "name" : "libchamplain",
-            "buildsystem": "meson",
             "sources" : [
                 {
                     "type" : "git",
-                    "url" : "https://gitlab.gnome.org/GNOME/libchamplain.git";
+                    "url" : "https://gitlab.gnome.org/GNOME/libshumate.git";
                 }
             ]
         },
diff --git a/src/application.js b/src/application.js
index e45a2d93..3856699e 100644
--- a/src/application.js
+++ b/src/application.js
@@ -25,8 +25,7 @@ import GObject from 'gi://GObject';
 import Geocode from 'gi://GeocodeGlib';
 import Gio from 'gi://Gio';
 import Gtk from 'gi://Gtk';
-import GtkClutter from 'gi://GtkClutter';
-import Hdy from 'gi://Handy';
+import Adw from 'gi://Adw';
 
 import {Geoclue} from './geoclue.js';
 import * as GeocodeFactory from './geocode.js';
@@ -140,9 +139,6 @@ export class Application extends Gtk.Application {
     vfunc_startup() {
         super.vfunc_startup();
 
-        GtkClutter.init(null);
-        Hdy.init();
-
         Utils.loadStyleSheet(Gio.file_new_for_uri('resource:///org/gnome/Maps/application.css'));
 
         Application.application = this;
@@ -163,8 +159,8 @@ export class Application extends Gtk.Application {
         }, Application.settings);
 
 
-        this._styleManager = Hdy.StyleManager.get_default();
-        this._styleManager.set_color_scheme(Hdy.ColorScheme.PREFER_LIGHT);
+        this._styleManager = Adw.StyleManager.get_default();
+        this._styleManager.set_color_scheme(Adw.ColorScheme.PREFER_LIGHT);
 
         Gtk.IconTheme.get_default().append_search_path(GLib.build_filenamev([pkg.pkgdatadir,
                                                                              'icons']));
diff --git a/src/contextMenu.js b/src/contextMenu.js
index 0b71b08e..e4d406ea 100644
--- a/src/contextMenu.js
+++ b/src/contextMenu.js
@@ -36,7 +36,7 @@ import {RouteQuery} from './routeQuery.js';
 import * as Utils from './utils.js';
 import {ZoomInDialog} from './zoomInDialog.js';
 
-export class ContextMenu extends Gtk.Menu {
+export class ContextMenu extends Gtk.PopoverMenu {
     constructor(params) {
         let mapView = params.mapView;
         delete params.mapView;
diff --git a/src/epaf.js b/src/epaf.js
index 8235e8f5..93254328 100644
--- a/src/epaf.js
+++ b/src/epaf.js
@@ -23,7 +23,7 @@
 // Google encoded polyline decoder
 // https://developers.google.com/maps/documentation/utilities/polylinealgorithm
 
-import Champlain from 'gi://Champlain';
+import Shumate from 'gi://Shumate';
 
 function _decodeValue(data, index) {
     let b;
@@ -61,7 +61,7 @@ export function decode(data) {
         // first value is absolute, rest are relative to previous value
         lat += latdelta;
         lon += londelta;
-        polyline.push(new Champlain.Coordinate({
+        polyline.push(new Shumate.Coordinate({
             latitude:  lat * 1e-5,
             longitude: lon * 1e-5
         }));
diff --git a/src/graphHopperTransit.js b/src/graphHopperTransit.js
index e60aff80..76d6411b 100644
--- a/src/graphHopperTransit.js
+++ b/src/graphHopperTransit.js
@@ -25,7 +25,7 @@
  * routing for walking legs
  */
 
-import Champlain from 'gi://Champlain';
+import Shumate from 'gi://Shumate';
 
 import {Application} from './application.js';
 import {Location} from './location.js';
@@ -64,10 +64,10 @@ export function createWalkingLeg(from, to, fromName, toName, route) {
 
 // create a straight-line "as the crow flies" polyline between two places
 function createStraightPolyline(fromLoc, toLoc) {
-    return [new Champlain.Coordinate({ latitude: fromLoc.latitude,
-                                       longitude: fromLoc.longitude }),
-            new Champlain.Coordinate({ latitude: toLoc.latitude,
-                                       longitude: toLoc.longitude })];
+    return [new Shumate.Coordinate({ latitude: fromLoc.latitude,
+                                     longitude: fromLoc.longitude }),
+            new Shumate.Coordinate({ latitude: toLoc.latitude,
+                                     longitude: toLoc.longitude })];
 }
 
 var _walkingRoutes = [];
diff --git a/src/main.js b/src/main.js
index d46faa94..3cd2c29f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -20,21 +20,17 @@
  *         Zeeshan Ali (Khattak) <zeeshanak gnome org>
  */
 
-import 'gi://Champlain?version=0.12';
-import 'gi://Clutter?version=1.0';
-import 'gi://Cogl?version=1.0';
+import 'gi://Adw?version=1';
 import 'gi://GeocodeGlib?version=1.0';
-import 'gi://Gdk?version=3.0';
+import 'gi://Gdk?version=4.0';
 import 'gi://GdkPixbuf?version=2.0';
 import 'gi://Gio?version=2.0';
 import 'gi://GLib?version=2.0';
 import 'gi://GObject?version=2.0';
-import 'gi://Gtk?version=3.0';
-import 'gi://GtkChamplain?version=0.12';
-import 'gi://GtkClutter?version=1.0';
+import 'gi://Gtk?version=4.0';
 import 'gi://GWeather?version=4.0';
-import 'gi://Handy?version=1';
 import 'gi://Rest?version=0.7';
+import 'gi://Shumate?version=0.0';
 import 'gi://Soup?version=2.4';
 
 import * as system from 'system';
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 6429dbc1..a35cc087 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -22,12 +22,12 @@
 
 import gettext from 'gettext';
 
-import Champlain from 'gi://Champlain';
 import GLib from 'gi://GLib';
 import GObject from 'gi://GObject';
 import Gdk from 'gi://Gdk';
 import Gio from 'gi://Gio';
 import Gtk from 'gi://Gtk';
+import Shumate from 'gi://Shumate';
 
 import {Application} from './application.js';
 import {ContextMenu} from './contextMenu.js';
diff --git a/src/storedRoute.js b/src/storedRoute.js
index 1fbfef3f..094657d0 100644
--- a/src/storedRoute.js
+++ b/src/storedRoute.js
@@ -20,9 +20,9 @@
  * Author: Jonas Danielsson <jonas threetimestwo org>
  */
 
-import Champlain from 'gi://Champlain';
 import GObject from 'gi://GObject';
 import Gtk from 'gi://Gtk';
+import Shumate from 'gi://Shumate';
 
 import {Place} from './place.js';
 import {Route, TurnPoint} from './route.js';
@@ -175,15 +175,15 @@ export class StoredRoute extends Place {
                 prop.path = prop.path.map((coordinate) => {
                     let lat = coordinate.latitude;
                     let lon = coordinate.longitude;
-                    return new Champlain.Coordinate({ latitude: lat,
-                                                      longitude: lon });
+                    return new Shumate.Coordinate({ latitude: lat,
+                                                    longitude: lon });
                 });
                 prop.turnPoints = prop.turnPoints.map((turnPoint) => {
                     let lat = turnPoint.coordinate.latitude;
                     let lon = turnPoint.coordinate.longitude;
 
-                    let coordinate = new Champlain.Coordinate({ latitude: lat,
-                                                                longitude: lon });
+                    let coordinate = new Shumate.Coordinate({ latitude: lat,
+                                                              longitude: lon });
 
                     return new TurnPoint({
                         coordinate: coordinate,


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