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
This commit is contained in:
Michael Gratton 2021-05-15 22:14:49 +10:00
parent 62eb1a6eff
commit 1c1912d006
8 changed files with 18 additions and 16 deletions

View file

@ -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')
)

View file

@ -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);

View file

@ -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;

View file

@ -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"

View file

@ -168,7 +168,6 @@ client_dependencies = [
libpeas,
libpeas_gtk,
libsecret,
libsoup,
libxml,
posix,
webkit2gtk,

View file

@ -16,7 +16,6 @@ plugin_dependencies = [
libhandy,
libmath,
libpeas,
libsoup,
webkit2gtk,
]

View file

@ -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;

View file

@ -107,7 +107,6 @@ bin_dependencies = [
libhandy,
libmath,
libpeas,
libsoup,
webkit2gtk,
]