Skip to content

Commit

Permalink
Add support for evolution-data-server 3.45+ / libsoup-3 (#248)
Browse files Browse the repository at this point in the history
* meson: Check glib version

* CaldavDialog: Use Uri.parse if available

* CI: Build for fedora latest

* CI: Tag switchboard dependency

* Update

* Update

* Satisfy linter

* Update

* Update

* Update src/Dialogs/CaldavDialog.vala

* Update src/Dialogs/CaldavDialog.vala

Co-authored-by: Corentin Noël <tintou@noel.tf>

* CaldavDialog: Do not indent macros

Co-authored-by: Corentin Noël <tintou@noel.tf>
  • Loading branch information
meisenzahl and tintou authored Jan 12, 2023
1 parent f38f705 commit 08faf7b
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 0 deletions.
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
29 changes: 29 additions & 0 deletions 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
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);
#if HAS_EDS_3_45
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) {
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,20 @@ 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 ();

unowned var uri_user = webdav_extension.uri.get_user ();
if (uri_user != null && uri_user != "") {
url_entry.text = url_entry.text.replace (uri_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
}

display_name_entry.text = collection_source.display_name;
Expand Down Expand Up @@ -589,7 +610,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

0 comments on commit 08faf7b

Please sign in to comment.