[geary] build: Remove explicit libsoup dependency
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] build: Remove explicit libsoup dependency
- Date: Sat, 15 May 2021 12:18:55 +0000 (UTC)
commit 1c1912d0061bb59525b870767d08b16c09acc8da
Author: Michael Gratton <mike vee net>
Date: Sat May 15 22:14:49 2021 +1000
build: Remove explicit libsoup dependency
Replace all uses of libsoup with their GLib equivalents, and remove the
build dependency.
See GNOME/gnome-build-meta#378
meson.build | 1 -
src/client/components/components-web-view.vala | 5 +----
src/client/composer/composer-link-popover.vala | 10 +++++++---
src/client/conversation-viewer/conversation-message.vala | 8 ++++----
src/client/meson.build | 1 -
src/client/plugin/meson.build | 1 -
src/client/web-process/web-process-extension.vala | 7 ++++++-
src/meson.build | 1 -
8 files changed, 18 insertions(+), 16 deletions(-)
---
diff --git a/meson.build b/meson.build
index d0af9eef8..233e8c56b 100644
--- a/meson.build
+++ b/meson.build
@@ -95,7 +95,6 @@ libpeas = dependency('libpeas-1.0', version: '>= 1.24.0')
libpeas_gtk = dependency('libpeas-gtk-1.0', version: '>= 1.24.0')
libsecret = dependency('libsecret-1', version: '>= 0.11')
libstemmer_dep = cc.find_library('stemmer')
-libsoup = dependency('libsoup-2.4', version: '>= 2.48')
libunwind_dep = dependency(
'libunwind', version: '>= 1.1', required: get_option('libunwind')
)
diff --git a/src/client/components/components-web-view.vala b/src/client/components/components-web-view.vala
index fe3c036d2..4ec857f92 100644
--- a/src/client/components/components-web-view.vala
+++ b/src/client/components/components-web-view.vala
@@ -696,7 +696,7 @@ public abstract class Components.WebView : WebKit.WebView, Geary.BaseInterface {
}
private bool handle_internal_response(WebKit.URISchemeRequest request) {
- string name = soup_uri_decode(request.get_path());
+ string name = GLib.Uri.unescape_string(request.get_path());
Geary.Memory.Buffer? buf = this.internal_resources[name];
bool handled = false;
if (buf != null) {
@@ -853,6 +853,3 @@ public abstract class Components.WebView : WebKit.WebView, Geary.BaseInterface {
}
}
-
-// XXX this needs to be moved into the libsoup bindings
-extern string soup_uri_decode(string part);
diff --git a/src/client/composer/composer-link-popover.vala b/src/client/composer/composer-link-popover.vala
index 63ec71ee5..c4bc3d963 100644
--- a/src/client/composer/composer-link-popover.vala
+++ b/src/client/composer/composer-link-popover.vala
@@ -52,7 +52,7 @@ public class Composer.LinkPopover : Gtk.Popover {
/** Emitted when the link URL has changed. */
- public signal void link_changed(Soup.URI? uri, bool is_valid);
+ public signal void link_changed(GLib.Uri? uri, bool is_valid);
/** Emitted when the link URL was activated. */
public signal void link_activate();
@@ -99,9 +99,13 @@ public class Composer.LinkPopover : Gtk.Popover {
bool is_valid = false;
bool is_nominal = false;
bool is_mailto = false;
- Soup.URI? url = null;
+ GLib.Uri? url = null;
if (!is_empty) {
- url = new Soup.URI(text);
+ try {
+ url = GLib.Uri.parse(text, PARSE_RELAXED);
+ } catch (GLib.UriError err) {
+ debug("Invalid link URI: %s", err.message);
+ }
if (url != null) {
is_valid = true;
diff --git a/src/client/conversation-viewer/conversation-message.vala
b/src/client/conversation-viewer/conversation-message.vala
index c15f3f8fc..d7492b9f8 100644
--- a/src/client/conversation-viewer/conversation-message.vala
+++ b/src/client/conversation-viewer/conversation-message.vala
@@ -1335,16 +1335,16 @@ public class ConversationMessage : Gtk.Grid, Geary.BaseInterface {
string href,
Gdk.Rectangle location) {
string text_href = text;
- if (Uri.parse_scheme(text_href) == null) {
+ if (GLib.Uri.parse_scheme(text_href) == null) {
text_href = "http://" + text_href;
}
- string text_label = Soup.URI.decode(text_href);
+ string? text_label = GLib.Uri.unescape_string(text_href) ?? _("(unknown)");
string anchor_href = href;
- if (Uri.parse_scheme(anchor_href) == null) {
+ if (GLib.Uri.parse_scheme(anchor_href) == null) {
anchor_href = "http://" + anchor_href;
}
- string anchor_label = Soup.URI.decode(anchor_href);
+ string anchor_label = GLib.Uri.unescape_string(anchor_href) ?? _("(unknown)");
Gtk.Builder builder = new Gtk.Builder.from_resource(
"/org/gnome/Geary/conversation-message-link-popover.ui"
diff --git a/src/client/meson.build b/src/client/meson.build
index ff3c8a6d3..ba151e420 100644
--- a/src/client/meson.build
+++ b/src/client/meson.build
@@ -168,7 +168,6 @@ client_dependencies = [
libpeas,
libpeas_gtk,
libsecret,
- libsoup,
libxml,
posix,
webkit2gtk,
diff --git a/src/client/plugin/meson.build b/src/client/plugin/meson.build
index e6db08535..b795237e8 100644
--- a/src/client/plugin/meson.build
+++ b/src/client/plugin/meson.build
@@ -16,7 +16,6 @@ plugin_dependencies = [
libhandy,
libmath,
libpeas,
- libsoup,
webkit2gtk,
]
diff --git a/src/client/web-process/web-process-extension.vala
b/src/client/web-process/web-process-extension.vala
index c36c4e28d..dc686350a 100644
--- a/src/client/web-process/web-process-extension.vala
+++ b/src/client/web-process/web-process-extension.vala
@@ -68,7 +68,12 @@ public class GearyWebExtension : Object {
WebKit.URIRequest request,
WebKit.URIResponse? response) {
bool should_load = false;
- Soup.URI? uri = new Soup.URI(request.get_uri());
+ GLib.Uri? uri = null;
+ try {
+ uri = GLib.Uri.parse(request.get_uri(), NONE);
+ } catch (GLib.UriError err) {
+ warning("Invalid request URI: %s", err.message);
+ }
if (uri != null && uri.get_scheme() in ALLOWED_SCHEMES) {
// Always load internal resources
should_load = true;
diff --git a/src/meson.build b/src/meson.build
index 5eded12e6..4e7752ab9 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -107,7 +107,6 @@ bin_dependencies = [
libhandy,
libmath,
libpeas,
- libsoup,
webkit2gtk,
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]