Skip to content

Commit

Permalink
Drop old Soup support
Browse files Browse the repository at this point in the history
  • Loading branch information
danirabbit committed Dec 3, 2024
1 parent 01e4516 commit 752bfcc
Show file tree
Hide file tree
Showing 8 changed files with 7 additions and 61 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
You'll need the following dependencies:
* libcamel1.2-dev
* libedataserver1.2-dev
* libedataserverui1.2-dev
* libedataserverui1.2-dev >=3.45.1
* libfolks-dev
* libgee-0.8-dev
* libglib2.0-dev
Expand Down
13 changes: 3 additions & 10 deletions docs/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,9 @@ basic_command = [
'--use-svg-images'
]

if libedataserverui_dep.version().version_compare('>=3.45.1')
basic_command += [
'--pkg', 'webkit2gtk-4.1',
'--define=HAS_SOUP_3'
]
else
basic_command += [
'--pkg', 'webkit2gtk-4.0',
]
endif
basic_command += [
'--pkg', 'webkit2gtk-4.0',
]

all_doc_target = custom_target(
'full documentation',
Expand Down
12 changes: 3 additions & 9 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,9 @@ gee_dep = dependency('gee-0.8')
handy_dep = dependency('libhandy-1', version: '>=1.1.90')
camel_dep = dependency('camel-1.2', version: '>= 3.28')
libedataserver_dep = dependency('libedataserver-1.2', version: '>= 3.28')
libedataserverui_dep = dependency('libedataserverui-1.2', version: '>= 3.28')
if libedataserverui_dep.version().version_compare('>=3.45.1')
add_project_arguments('--define=HAS_SOUP_3', language: 'vala')
webkit2_dep = dependency('webkit2gtk-4.1')
webkit2_web_extension_dep = dependency('webkit2gtk-web-extension-4.1')
else
webkit2_dep = dependency('webkit2gtk-4.0', version: '>=2.28')
webkit2_web_extension_dep = dependency('webkit2gtk-web-extension-4.0', version: '>=2.28')
endif
libedataserverui_dep = dependency('libedataserverui-1.2', version: '>=3.45.1')
webkit2_dep = dependency('webkit2gtk-4.1')
webkit2_web_extension_dep = dependency('webkit2gtk-web-extension-4.1')
libportal_dep = dependency('libportal')
libportal_gtk_dep = dependency('libportal-gtk3')
folks_dep = dependency('folks')
Expand Down
21 changes: 0 additions & 21 deletions src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public class Mail.Application : Gtk.Application {
string to = null;

try {
#if HAS_SOUP_3
GLib.Uri? mailto= null;
try {
mailto = GLib.Uri.parse (mailto_uri, GLib.UriFlags.NONE);
Expand All @@ -86,26 +85,6 @@ public class Mail.Application : Gtk.Application {
new Composer (to, mailto.get_query ()).present ();
});
}
#else
Soup.URI mailto = new Soup.URI (mailto_uri);
if (mailto == null) {
throw new OptionError.BAD_VALUE ("Argument is not a URL.");
}

if (mailto.scheme != "mailto") {
throw new OptionError.BAD_VALUE ("Cannot open non-mailto: URL");
}

to = Soup.URI.decode (mailto.path);

if (main_window.is_session_started) {
new Composer (to, mailto.query).present ();
} else {
main_window.session_started.connect (() => {
new Composer (to, mailto.query).present ();
});
}
#endif
} catch (OptionError e) {
warning ("Argument parsing error. %s", e.message);
}
Expand Down
8 changes: 0 additions & 8 deletions src/Composer.vala
Original file line number Diff line number Diff line change
Expand Up @@ -375,11 +375,7 @@ public class Mail.Composer : Hdy.ApplicationWindow {
foreach (unowned string param in params) {
var terms = param.split ("=");
if (terms.length == 2) {
#if HAS_SOUP_3
result[terms[0].down ()] = (GLib.Uri.unescape_string (terms[1]));
#else
result[terms[0].down ()] = (Soup.URI.decode (terms[1]));
#endif
} else {
critical ("Invalid mailto URL");
}
Expand Down Expand Up @@ -517,11 +513,7 @@ public class Mail.Composer : Hdy.ApplicationWindow {
private void on_mouse_target_changed (WebKit.WebView web_view, WebKit.HitTestResult hit_test, uint mods) {
if (hit_test.context_is_link ()) {
var url = hit_test.get_link_uri ();
#if HAS_SOUP_3
var hover_url = url != null ? GLib.Uri.unescape_string (url) : null;
#else
var hover_url = url != null ? Soup.URI.decode (url) : null;
#endif

if (hover_url == null) {
message_url_overlay.hide ();
Expand Down
4 changes: 0 additions & 4 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ public class Mail.MainWindow : Hdy.ApplicationWindow {
message_overlay.no_show_all = true;

message_list.hovering_over_link.connect ((label, url) => {
#if HAS_SOUP_3
var hover_url = url != null ? GLib.Uri.unescape_string (url) : null;
#else
var hover_url = url != null ? Soup.URI.decode (url) : null;
#endif

if (hover_url == null) {
message_overlay.hide ();
Expand Down
4 changes: 0 additions & 4 deletions src/WebView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -258,11 +258,7 @@ public class Mail.WebView : WebKit.WebView {
}

private bool handle_internal_response (WebKit.URISchemeRequest request) {
#if HAS_SOUP_3
string uri = GLib.Uri.unescape_string (request.get_uri ());
#else
string uri = Soup.URI.decode (request.get_uri ());
#endif
InputStream? buf = this.internal_resources[uri];
if (buf != null) {
request.finish (buf, -1, null);
Expand Down
4 changes: 0 additions & 4 deletions webkit-extension/MailPage.vala
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,13 @@ public class Mail.Page : Object {

private bool on_send_request (WebKit.WebPage page, WebKit.URIRequest request, WebKit.URIResponse? response) {
bool should_load = false;
#if HAS_SOUP_3
GLib.Uri? uri = null;
try {
uri = GLib.Uri.parse (request.get_uri (), GLib.UriFlags.NONE);
} catch (Error e) {
warning ("Could not parse uri: %s", e.message);
return should_load;
}
#else
Soup.URI? uri = new Soup.URI (request.get_uri ());
#endif
if (uri != null && uri.get_scheme () in ALLOWED_SCHEMES) {
// Always load internal resources
should_load = true;
Expand Down

0 comments on commit 752bfcc

Please sign in to comment.