Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for evolution-data-server 3.45+ / libsoup-3 #248

Merged
merged 13 commits into from
Jan 12, 2023
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,41 @@ jobs:
ninja -C build
ninja -C build install

fedora:
runs-on: ubuntu-latest

container:
image: fedora:latest

steps:
- uses: actions/checkout@v3
- name: Install Dependencies
run: |
dnf install -y git meson ninja-build vala evolution-data-server-devel glib2-devel granite-devel gtk3-devel libhandy-devel
git clone --depth 1 https://github.com/elementary/granite
dnf install -y libgee-devel
cd granite
meson build --prefix=/usr
ninja -C build
ninja -C build install
cd ..
rm -rf granite
git clone --depth 1 --branch 6.0.2 https://github.com/elementary/switchboard
dnf install -y libadwaita-devel
cd switchboard
meson build --prefix=/usr
ninja -C build
ninja -C build install
cd ..
rm -rf switchboard
- name: Build
env:
DESTDIR: out
run: |
meson build
ninja -C build
ninja -C build install

lint:

runs-on: ubuntu-latest
Expand Down
4 changes: 4 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ if edataserverui_dep.version().version_compare('>=3.39.2')
add_project_arguments('--define=HAS_EDS_3_40', language: 'vala')
endif

if edataserver_dep.version().version_compare('>=3.45.1')
add_project_arguments('--define=HAS_EDS_3_45', language: 'vala')
endif

gresource = gnome.compile_resources(
'gresource',
'data' / 'gresource.xml',
Expand Down
30 changes: 29 additions & 1 deletion src/Dialogs/CaldavDialog.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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_45
meisenzahl marked this conversation as resolved.
Show resolved Hide resolved
webdav.uri = Uri.parse (url_entry.text, UriFlags.PARSE_RELAXED);
#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);
Expand Down Expand Up @@ -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);
webdav_host = webdav_extension.soup_uri.host;
#if HAS_EDS_3_45
webdav_host = webdav_extension.uri.get_host ();
#else
webdav_host = webdav_extension.soup_uri.host;
meisenzahl marked this conversation as resolved.
Show resolved Hide resolved
#endif
}

foreach (unowned E.WebDAVDiscoveredSource? disc_source in discovered_sources) {
Expand All @@ -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_45
webdav.uri = Uri.parse (disc_source.href, UriFlags.PARSE_RELAXED);
#else
webdav.soup_uri = new Soup.URI (disc_source.href);
#endif
webdav.color = disc_source.color;

switch (only_supports) {
Expand Down Expand Up @@ -550,11 +562,19 @@ 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_45
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 () + "@", "");
}
meisenzahl marked this conversation as resolved.
Show resolved Hide resolved
#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
}

display_name_entry.text = collection_source.display_name;
Expand Down Expand Up @@ -589,7 +609,15 @@ 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_45
try {
webdav_extension.uri = Uri.parse (url_entry.text, UriFlags.PARSE_RELAXED);
} catch (Error e) {
warning ("Unable to save webdav extension: %s", e.message);
}
#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);
Expand Down