void-packages/srcpkgs/io.elementary.calendar/patches/libsoup3.patch

138 lines
6.1 KiB
Diff

From 62c20e5786accd68b96c423b04e32c043e726cac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Corentin=20No=C3=ABl?= <tintou@noel.tf>
Date: Sun, 7 Aug 2022 21:18:35 +0200
Subject: [PATCH] Add support for Evolution Data Server 3.46
EDS 3.46 has switched to libsoup-3
Co-authored-by: Bobby Rong <rjl931189261@126.com>
---
meson.build | 10 ++++++++--
plugins/CalDAV/CalDAVBackend.vala | 12 ++++++++++++
plugins/Google/GoogleBackend.vala | 26 ++++++++++++++++++++++++++
3 files changed, 46 insertions(+), 2 deletions(-)
diff --git a/meson.build b/meson.build
index ff7a2d0f9..703a9686d 100644
--- a/meson.build
+++ b/meson.build
@@ -28,14 +28,20 @@ gtk_dep = dependency('gtk+-3.0', version: '>=3.22')
handy_dep = dependency('libhandy-1', version: '>=0.90.0')
libedataserver_dep = dependency('libedataserver-1.2', version: '>=3.8.0')
libedataserverui_dep = dependency('libedataserverui-1.2', version: '>=3.8.0')
-libsoup_dep = dependency('libsoup-2.4')
+if (libedataserver_dep.version().version_compare ('>=3.46'))
+ libsoup_dep = []
+ geocode_glib_dep = dependency('geocode-glib-2.0')
+ add_project_arguments('--define', 'HAS_EDS_3_46', language: 'vala')
+else
+ geocode_glib_dep = dependency('geocode-glib-1.0')
+ libsoup_dep = dependency('libsoup-2.4')
+endif
gmodule_dep = dependency('gmodule-2.0')
champlain_dep = dependency('champlain-0.12')
champlain_gtk_dep = dependency('champlain-gtk-0.12')
clutter_dep = dependency('clutter-1.0')
clutter_gtk_dep = dependency('clutter-gtk-1.0')
folks_dep = dependency('folks')
-geocode_glib_dep = dependency('geocode-glib-1.0')
gclue_dep = dependency('libgeoclue-2.0')
libecal_dep = dependency('libecal-2.0')
libical_dep = dependency('libical-glib')
diff --git a/plugins/CalDAV/CalDAVBackend.vala b/plugins/CalDAV/CalDAVBackend.vala
index e1f6fde53..e4f5e0f5c 100644
--- a/plugins/CalDAV/CalDAVBackend.vala
+++ b/plugins/CalDAV/CalDAVBackend.vala
@@ -73,7 +73,11 @@ public class Maya.CalDavBackend : GLib.Object, Maya.Backend {
collection.add (url_entry);
if (to_edit != null) {
E.SourceWebdav webdav = (E.SourceWebdav)to_edit.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ var uri = webdav.dup_uri ();
+#else
var uri = webdav.dup_soup_uri ();
+#endif
if (uri.get_port () != 80) {
((Gtk.Entry)url_entry.widget).text = "%s://%s:%u%s".printf (uri.get_scheme (), uri.get_host (), uri.get_port (), uri.get_path ());
} else {
@@ -147,7 +151,11 @@ public class Maya.CalDavBackend : GLib.Object, Maya.Backend {
foreach (var widget in widgets) {
switch (widget.ref_name) {
case "url_entry":
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.parse (((Gtk.Entry)widget.widget).text, GLib.UriFlags.NONE);
+#else
webdav.soup_uri = new Soup.URI (((Gtk.Entry)widget.widget).text);
+#endif
break;
case "user_entry":
auth.user = ((Gtk.Entry)widget.widget).text;
@@ -190,7 +198,11 @@ public class Maya.CalDavBackend : GLib.Object, Maya.Backend {
foreach (var widget in widgets) {
switch (widget.ref_name) {
case "url_entry":
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.parse (((Gtk.Entry)widget.widget).text, GLib.UriFlags.NONE);
+#else
webdav.soup_uri = new Soup.URI (((Gtk.Entry)widget.widget).text);
+#endif
break;
case "user_entry":
auth.user = ((Gtk.Entry)widget.widget).text;
diff --git a/plugins/Google/GoogleBackend.vala b/plugins/Google/GoogleBackend.vala
index 2f9fa3f2b..3f77bd13b 100644
--- a/plugins/Google/GoogleBackend.vala
+++ b/plugins/Google/GoogleBackend.vala
@@ -83,12 +83,25 @@ public class Maya.GoogleBackend : GLib.Object, Maya.Backend {
}
auth.user = decoded_user;
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.build (
+ GLib.UriFlags.NONE,
+ "https",
+ null,
+ "www.google.com",
+ -1,
+ "/calendar/dav/%s/events".printf (decoded_user),
+ null,
+ null
+ );
+#else
var soup_uri = new Soup.URI (null);
soup_uri.set_host ("www.google.com");
soup_uri.set_scheme ("https");
soup_uri.set_user (decoded_user);
soup_uri.set_path ("/calendar/dav/%s/events".printf (decoded_user));
webdav.soup_uri = soup_uri;
+#endif
break;
case "keep_copy":
offline.set_stay_synchronized (((Gtk.CheckButton)widget.widget).active);
@@ -128,12 +141,25 @@ public class Maya.GoogleBackend : GLib.Object, Maya.Backend {
}
auth.user = decoded_user;
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.build (
+ GLib.UriFlags.NONE,
+ "https",
+ null,
+ "www.google.com",
+ -1,
+ "/calendar/dav/%s/events".printf (decoded_user),
+ null,
+ null
+ );
+#else
var soup_uri = new Soup.URI (null);
soup_uri.set_host ("www.google.com");
soup_uri.set_scheme ("https");
soup_uri.set_user (decoded_user);
soup_uri.set_path ("/calendar/dav/%s/events".printf (decoded_user));
webdav.soup_uri = soup_uri;
+#endif
break;
case "keep_copy":
offline.set_stay_synchronized (((Gtk.CheckButton)widget.widget).active);