Skip to content

Commit

Permalink
Add support for Evolution Data Server 3.46 (#758)
Browse files Browse the repository at this point in the history
EDS 3.46 has switched to libsoup-3

Co-authored-by: Bobby Rong <rjl931189261@126.com>

Co-authored-by: Bobby Rong <rjl931189261@126.com>
Co-authored-by: Marius Meisenzahl <meisenzahl@users.noreply.github.com>
  • Loading branch information
3 people authored Jan 12, 2023
1 parent 7ade613 commit 9c6308b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
10 changes: 8 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
12 changes: 12 additions & 0 deletions plugins/CalDAV/CalDAVBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
26 changes: 26 additions & 0 deletions plugins/Google/GoogleBackend.vala
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 9c6308b

Please sign in to comment.