[gnome-maps/wip/mlundblad/libsoup3: 7/7] WIP: Port to libsoup3
- From: Marcus Lundblad <mlundblad src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-maps/wip/mlundblad/libsoup3: 7/7] WIP: Port to libsoup3
- Date: Wed, 17 Aug 2022 21:38:55 +0000 (UTC)
commit 49952aae0689d202cbaeed278f86c97e7509d977
Author: Marcus Lundblad <ml dfupdate se>
Date: Wed Aug 17 22:49:12 2022 +0200
WIP: Port to libsoup3
lib/meson.build | 2 +-
meson.build | 4 ++--
org.gnome.Maps.json | 18 +++++++++++++-----
src/graphHopperGeocode.js | 26 ++++++++++++++------------
src/main.js | 6 +++---
5 files changed, 33 insertions(+), 23 deletions(-)
---
diff --git a/lib/meson.build b/lib/meson.build
index ada8239d..82824e8c 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -49,7 +49,7 @@ gnome.generate_gir(
includes: [
'GLib-2.0',
'GObject-2.0',
- 'Rest-0.7',
+ 'Rest-1.0',
'Shumate-1.0'
],
install: true,
diff --git a/meson.build b/meson.build
index 13ddd0d4..f6b4a604 100644
--- a/meson.build
+++ b/meson.build
@@ -38,12 +38,12 @@ gtk4 = dependency('gtk4')
geoclue2 = dependency('geoclue-2.0', version: '>= 0.12.99')
libadwaita = dependency('libadwaita-1')
gweather = dependency('gweather4', version: '>= 3.90.0')
-geocodeglib = dependency('geocode-glib-1.0', version: '>= 3.15.2')
+geocodeglib = dependency('geocode-glib-2.0', version: '>= 3.15.2')
libmaps_deps = [
dependency('shumate-1.0'),
dependency('libxml-2.0'),
- dependency('rest-0.7', version: '>= 0.7.90')
+ dependency('rest-1.0')
]
msgfmt = find_program('msgfmt')
diff --git a/org.gnome.Maps.json b/org.gnome.Maps.json
index be095983..35a27a54 100644
--- a/org.gnome.Maps.json
+++ b/org.gnome.Maps.json
@@ -54,7 +54,8 @@
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
- "-Denable-gtk-doc=false"
+ "-Denable-gtk-doc=false",
+ "-Dsoup2=false"
],
"sources" : [
{
@@ -68,7 +69,7 @@
"config-opts" : [
"-Denable_vala=false",
"-Dgtk_doc=false",
- "-Dsoup2=true"
+ "-Dsoup2=false"
],
"buildsystem" : "meson",
"sources" : [
@@ -81,11 +82,17 @@
},
{
"name" : "librest",
+ "buildsystem": "meson",
+ "config-opts": [
+ "-Dgtk_doc=false",
+ "-Dexamples=false",
+ "-Dsoup2=false"
+ ],
"sources" : [
{
"type" : "archive",
- "url" : "https://gitlab.gnome.org/GNOME/librest/-/archive/0.8.1/librest-0.8.1.tar.gz",
- "sha256" : "2bdd1be07a9150b1c6ceea6e01dedf2efcff564381cae0cd6c7330403efe59d7"
+ "url" : "https://gitlab.gnome.org/GNOME/librest/-/archive/1.0.0/librest-1.0.0.tar.gz",
+ "sha256" : "eeba5ddbf91a29decec01c3ccce64b922bd9bf52d631e307e185227295aea51d"
}
]
},
@@ -95,7 +102,8 @@
"config-opts": [
"-Ddemos=false",
"-Dgtk_doc=false",
- "-Dvapi=false"
+ "-Dvapi=false",
+ "-Dlibsoup3=true"
],
"sources" : [
{
diff --git a/src/graphHopperGeocode.js b/src/graphHopperGeocode.js
index 790beb2a..70020011 100644
--- a/src/graphHopperGeocode.js
+++ b/src/graphHopperGeocode.js
@@ -44,21 +44,20 @@ export class GraphHopperGeocode {
let url = this._buildURL(string, latitude, longitude);
let msg = Soup.Message.new('GET', url);
- let handler = cancellable.connect(() => {
- this._session.cancel_message(msg, Soup.Status.CANCELLED);
- });
-
- this._session.queue_message(msg, (session, message) => {
- cancellable.disconnect(handler);
-
+ this._session.send_and_read_async(msg, GLib.PRIORITY_DEFAULT,
+ cancellable,
+ (source, res) => {
if (cancellable.is_cancelled())
return;
- if (message.status_code !== Soup.KnownStatusCode.OK) {
- callback(null, msg.status_code);
+ if (msg.get_status() !== Soup.Status.OK) {
+ callback(null, msg.get_status());
} else {
try {
- let result = this._parseMessage(message.response_body.data);
+ let buffer =
+ this._session.send_and_read_finish(res).get_data();
+ let result = this._parseMessage(Utils.getBufferText(buffer));
+
if (!result)
callback(null, null);
else
@@ -76,10 +75,13 @@ export class GraphHopperGeocode {
let msg = Soup.Message.new('GET', url);
Application.application.mark_busy();
- this._session.queue_message(msg, (session, message) => {
+ this._session.send_and_read_async(msg, GLib.PRIORITY_DEFAULT, null,
+ (source, res) => {
Application.application.unmark_busy();
try {
- let result = this._parseMessage(message.response_body.data);
+ let buffer = this._session.send_and_read_finish(res).get_data();
+
+ let result = this._parseMessage(Utils.getBufferText(buffer));
if (!result)
callback(null, null);
else
diff --git a/src/main.js b/src/main.js
index b7f0b87b..c2d16458 100644
--- a/src/main.js
+++ b/src/main.js
@@ -21,7 +21,7 @@
*/
import 'gi://Adw?version=1';
-import 'gi://GeocodeGlib?version=1.0';
+import 'gi://GeocodeGlib?version=2.0';
import 'gi://Gdk?version=4.0';
import 'gi://GdkPixbuf?version=2.0';
import 'gi://Gio?version=2.0';
@@ -29,9 +29,9 @@ import 'gi://GLib?version=2.0';
import 'gi://GObject?version=2.0';
import 'gi://Gtk?version=4.0';
import 'gi://GWeather?version=4.0';
-import 'gi://Rest?version=0.7';
+import 'gi://Rest?version=1.0';
import 'gi://Shumate?version=1.0';
-import 'gi://Soup?version=2.4';
+import 'gi://Soup?version=3.0';
import * as system from 'system';
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]