Patch switchboard-plug-onlineaccounts

This commit is contained in:
windowsboy111
2022-10-18 21:59:41 +08:00
parent 1ac340eb4f
commit 83fdfb2d6a
2 changed files with 95 additions and 3 deletions
@@ -0,0 +1,94 @@
From b60f0458a23a2f76ad14d399f145e150e1ab82d3 Mon Sep 17 00:00:00 2001
From: Bobby Rong <rjl931189261@126.com>
Date: Sat, 23 Jul 2022 10:45:28 +0800
Subject: [PATCH] build: support evolution-data-server 3.45
---
meson.build | 3 +++
src/Dialogs/CaldavDialog.vala | 23 +++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/meson.build b/meson.build
index 61fa00b5..72387657 100644
--- a/meson.build
+++ b/meson.build
@@ -44,6 +44,9 @@ switchboard_dep = dependency('switchboard-2.0')
if edataserverui_dep.version().version_compare('>=3.39.2')
add_project_arguments('--define=HAS_EDS_3_40', language: 'vala')
endif
+if edataserverui_dep.version().version_compare('>=3.45.1')
+ add_project_arguments('--define=HAS_EDS_3_46', language: 'vala')
+endif
gresource = gnome.compile_resources(
'gresource',
diff --git a/src/Dialogs/CaldavDialog.vala b/src/Dialogs/CaldavDialog.vala
index b658b266..c6c934b2 100644
--- a/src/Dialogs/CaldavDialog.vala
+++ b/src/Dialogs/CaldavDialog.vala
@@ -397,7 +397,11 @@ public class OnlineAccounts.CaldavDialog : Hdy.Window {
col.backend_name = "caldav";
unowned var webdav = (E.SourceWebdav)source.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.parse (url_entry.text, GLib.UriFlags.NONE);
+#else
webdav.soup_uri = new Soup.URI (url_entry.text);
+#endif
webdav.calendar_auto_schedule = true;
unowned var auth = (E.SourceAuthentication)source.get_extension (E.SOURCE_EXTENSION_AUTHENTICATION);
@@ -473,7 +477,11 @@ public class OnlineAccounts.CaldavDialog : Hdy.Window {
string? webdav_host = null;
if (source.has_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND)) {
unowned var webdav_extension = (E.SourceWebdav) source.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ webdav_host = webdav_extension.uri.get_host ();
+#else
webdav_host = webdav_extension.soup_uri.host;
+#endif
}
foreach (unowned E.WebDAVDiscoveredSource? disc_source in discovered_sources) {
@@ -486,7 +494,11 @@ public class OnlineAccounts.CaldavDialog : Hdy.Window {
};
unowned var webdav = (E.SourceWebdav) e_source.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ webdav.uri = GLib.Uri.parse (disc_source.href, GLib.UriFlags.NONE);
+#else
webdav.soup_uri = new Soup.URI (disc_source.href);
+#endif
webdav.color = disc_source.color;
switch (only_supports) {
@@ -550,10 +562,17 @@ public class OnlineAccounts.CaldavDialog : Hdy.Window {
if (collection_source.has_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND)) {
unowned var webdav_extension = (E.SourceWebdav) collection_source.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ url_entry.text = webdav_extension.uri.to_string ();
+
+ if (webdav_extension.uri.get_user () != null && webdav_extension.uri.get_user () != "") {
+ url_entry.text = url_entry.text.replace (webdav_extension.uri.get_user () + "@", "");
+#else
url_entry.text = webdav_extension.soup_uri.to_string (false);
if (webdav_extension.soup_uri.user != null && webdav_extension.soup_uri.user != "") {
url_entry.text = url_entry.text.replace (webdav_extension.soup_uri.user + "@", "");
+#endif
}
}
@@ -589,7 +608,11 @@ public class OnlineAccounts.CaldavDialog : Hdy.Window {
authentication_extension.user = username_entry.text;
unowned var webdav_extension = (E.SourceWebdav) collection_source.get_extension (E.SOURCE_EXTENSION_WEBDAV_BACKEND);
+#if HAS_EDS_3_46
+ webdav_extension.uri = GLib.Uri.parse (url_entry.text, GLib.UriFlags.NONE);
+#else
webdav_extension.soup_uri = new Soup.URI (url_entry.text);
+#endif
webdav_extension.calendar_auto_schedule = true;
unowned var offline_extension = (E.SourceOffline) collection_source.get_extension (E.SOURCE_EXTENSION_OFFLINE);
@@ -18,9 +18,7 @@ BuildRequires: libappstream-glib
BuildRequires: meson
BuildRequires: vala
# FIXME: Actually patch this module to accomodate for the new evolution-data-server API
# todo for windowsboy111: Actually patch this module
Patch0: b60f0458a23a2f76ad14d399f145e150e1ab82d3.patch
BuildRequires: pkgconfig(camel-1.2) = 3.44.4
BuildRequires: pkgconfig(glib-2.0)