[libgepub/libsoup3] Use libsoup 3.0




commit 5a6736073654b97eda07d9b46e8358085eb939c7
Author: Daniel GarcĂ­a Moreno <dani danigm net>
Date:   Mon Aug 29 08:05:48 2022 +0200

    Use libsoup 3.0
    
    Fix https://gitlab.gnome.org/GNOME/libgepub/-/issues/15

 libgepub/gepub-utils.c  | 13 +++++--------
 libgepub/gepub-widget.c |  8 ++++----
 libgepub/meson.build    |  2 +-
 meson.build             |  4 ++--
 4 files changed, 12 insertions(+), 15 deletions(-)
---
diff --git a/libgepub/gepub-utils.c b/libgepub/gepub-utils.c
index d4fc8b0..dd65f36 100644
--- a/libgepub/gepub-utils.c
+++ b/libgepub/gepub-utils.c
@@ -42,10 +42,10 @@ set_epub_uri (xmlNode *node,
 
     gchar *attrname = NULL;
 
-    SoupURI *baseURI;
+    g_autoptr (GUri) baseURI = NULL;
     gchar *basepath = g_strdup_printf ("epub:///%s/", path);
 
-    baseURI = soup_uri_new (basepath);
+    baseURI = g_uri_parse (basepath, SOUP_HTTP_URI_FLAGS, NULL);
     g_free (basepath);
 
     if (ns) {
@@ -59,15 +59,14 @@ set_epub_uri (xmlNode *node,
             text = xmlGetProp (cur_node, BAD_CAST (attr));
 
             if (!strcmp ((const char *) cur_node->name, tagname) && text && text[0] != '#') {
-                SoupURI *uri = soup_uri_new_with_base (baseURI, (const char *) text);
-                gchar *value = soup_uri_to_string (uri, FALSE);
+                g_autoptr (GUri) uri = g_uri_parse_relative (baseURI, (const char *) text, 
SOUP_HTTP_URI_FLAGS, NULL);
+                gchar *value = g_uri_to_string (uri);
 
-                if (!g_str_equal (soup_uri_get_scheme (uri), "epub"))
+                if (!g_str_equal (g_uri_get_scheme (uri), "epub"))
                     g_clear_pointer (&value, g_free);
 
                 xmlSetProp (cur_node, BAD_CAST (attrname), BAD_CAST (value));
 
-                soup_uri_free (uri);
                 g_free (value);
             }
             if (text) {
@@ -81,8 +80,6 @@ set_epub_uri (xmlNode *node,
     }
 
     g_free (attrname);
-
-    soup_uri_free (baseURI);
 }
 
 static gboolean
diff --git a/libgepub/gepub-widget.c b/libgepub/gepub-widget.c
index be93c05..6043524 100644
--- a/libgepub/gepub-widget.c
+++ b/libgepub/gepub-widget.c
@@ -231,18 +231,18 @@ set_current_chapter_by_uri (WebKitWebView  *web_view)
 {
     GepubWidget *widget = GEPUB_WIDGET (web_view);
     const gchar *uri_string;
-    SoupURI *uri;
+    GUri *uri;
     const gchar *path;
     gint chapter;
 
     uri_string = webkit_web_view_get_uri (web_view);
 
     if (g_strcmp0 ("about:blank", uri_string)) {
-        uri = soup_uri_new (uri_string);
-        path = soup_uri_get_path (uri);
+        uri = g_uri_parse (uri_string, SOUP_HTTP_URI_FLAGS, NULL);
+        path = g_uri_get_path (uri);
         chapter = gepub_doc_resource_uri_to_chapter (widget->doc, path);
         gepub_doc_set_chapter (widget->doc, chapter);
-        soup_uri_free (uri);
+        g_uri_unref (uri);
     }
     // Else we're on the cover or table of contents (and can't tell which)
     // but we can only get there through setting the chapter number
diff --git a/libgepub/meson.build b/libgepub/meson.build
index 5e425c2..65c8463 100644
--- a/libgepub/meson.build
+++ b/libgepub/meson.build
@@ -69,7 +69,7 @@ if get_option('introspection') and get_option('default_library') == 'shared'
   gir_incs = [
     'GObject-2.0',
     'libxml2-2.0',
-    'WebKit2-4.0'
+    'WebKit2-4.1'
   ]
 
   gir_extra_args = '--warn-all'
diff --git a/meson.build b/meson.build
index 0cd602f..c868167 100644
--- a/meson.build
+++ b/meson.build
@@ -31,8 +31,8 @@ libversion = '@0@.@1@.@2@'.format(soversion, current, revision)
 cc = meson.get_compiler('c')
 
 gepub_deps = [
-  dependency('webkit2gtk-4.0'),
-  dependency('libsoup-2.4'),
+  dependency('webkit2gtk-4.1'),
+  dependency('libsoup-3.0'),
   dependency('glib-2.0'),
   dependency('gobject-2.0'),
   dependency('gio-2.0'),


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