Skip to content

Clock applet multiple data sources#1565

Open
oz123 wants to merge 9 commits into
mate-desktop:masterfrom
oz123:clock-applet-multiple-data-sources
Open

Clock applet multiple data sources#1565
oz123 wants to merge 9 commits into
mate-desktop:masterfrom
oz123:clock-applet-multiple-data-sources

Conversation

@oz123

@oz123 oz123 commented Jun 10, 2026

Copy link
Copy Markdown

Building on top of the work for getting events from EDS, I added the option to read events from vdir.

This is useful for people who don't want to install evolution just for getting calendar events shown in the applet. Also, it requires less RAM (no background process, as vdirsyncher can be launched using cron or a systemd user unit files).

This is my 3rd attempt to implement this feature (previous attempts not published), I hope this time I got it right,

oz123 added 3 commits June 10, 2026 22:19
Replace the monolithic EDS-only calendar-sources.c with an extensible
provider architecture:

- Add CalendarProvider abstract base class with virtual vtable and
  signals (appointments-changed, tasks-changed)
- Add CalendarEDSProvider: absorbs all EDS/calendar-sources logic,
  guarded by HAVE_EDS
- Add CalendarVdirProvider: reads vdir collections (vdirsyncer format),
  expands recurrences via libical-glib, watches directories with
  GFileMonitor, guarded by HAVE_LIBICAL
- Rewrite CalendarClient as a thin aggregator over a list of providers
- Auto-discover vdirsyncer default path (~/.local/share/vdirsyncer/)
  and allow extra paths via new GSettings key vdir-calendar-paths
- Add HAVE_LIBICAL autoconf check for libical-glib >= 3.0 (independent
  of EDS; EDS implies it)
- Update calendar-window.c guards from HAVE_EDS to
  HAVE_EDS || HAVE_LIBICAL so vdir events show without EDS

Remove calendar-sources.c/h (functionality absorbed into
calendar-eds-provider.c).

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
- Update #ifdef HAVE_EDS guards in clock.c to
  #if defined(HAVE_EDS) || defined(HAVE_LIBICAL) so the calendar
  client is created and passed to the calendar window when only
  libical is available (no EDS)
- Fix calendar_vdir_discover() to recurse one level into
  subdirectories that are not themselves vdir collections, matching
  vdirsyncer's layout: <base>/<pair-name>/<collection-name>/

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
Add applets/clock/README.md describing both calendar backends:
- Evolution Data Server integration (appointments and tasks)
- vdir/vdirsyncer support: auto-discovery, extra paths via GSettings,
  setup instructions, recurring events, and collection metadata

Add optional dependency entries for EDS and libical-glib to the
top-level README.

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
@oz123 oz123 requested a review from vkareh June 10, 2026 21:30
- Add libecal2.0-dev, libedataserver1.2-dev, libical-glib-dev to
  Debian/Ubuntu dependency list
- Add evolution-data-server, libical to Arch dependency list
- Add -DHAVE_EDS, -DHAVE_LIBICAL, -DLIBICAL_GLIB_UNSTABLE_API to
  cppcheck defines so the new calendar provider code paths are analysed
- Add libecal-2.0 and libical-glib to cppcheck pkg-config packages
  for correct include paths

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
@oz123 oz123 requested a review from lukefromdc June 10, 2026 21:34
oz123 added 5 commits June 11, 2026 10:02
Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
meeting titles were displayed as <b>event title</b> in the tooltip.

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
e_source_get_display_name is the correct method. Previously,
the code showd the protocol type ("caldav", "local", etc.)

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
Signed-off-by: Oz Tiram <oz.tiram@gmail.com>
i_cal_time_subtract() and i_cal_duration_as_int() were removed in newer
libical-glib (as shipped on Arch Linux).  Replace them with:
- direct i_cal_time_as_timet() subtraction for DTEND − DTSTART
- a portable ical_duration_as_secs() helper built from the individual
  i_cal_duration_get_{weeks,days,hours,minutes,seconds}() accessors

Property getter functions (i_cal_property_get_dtstart etc.) changed
their parameter from ICalProperty * to const ICalProperty * in newer
releases, making them incompatible as function-pointer arguments on both
old and new versions simultaneously.  Add thin prop_get_dt{start,end}/
prop_get_{due,completed} wrappers typed as ICalTime *(*)(ICalProperty *)
so the call sites compile cleanly against either API.

Signed-off-by: Oz Tiram <oz.tiram@gmail.com>

@lukefromdc lukefromdc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not know how to use vdirsyncer, I normally use text files on the desktop to manage events (primitive but hard to forget) so without a gui option to invoke it from the clock, I was unable to test that functionally. Didn't interfere with Evolution, though I have an empty calendar so obscure problems might not show up.

The line
password = "yourpassword"
in the example config file is a security hazard if users are supposed to store their login password (which gives ROOT access if they have sudo allowed!) in it!

Without it, on running
vdirsyncer discover my_calendar

I get

Discovering collections for pair my_calendar
my_local:
warning: Failed to discover collections for my_remote, use `-vdebug` to see the full traceback.
error: Unknown error occurred: Cannot connect to host your-caldav-server:443 ssl:default [Name or service not known]
error: Use `-vdebug` to see the full traceback.
luke@ubuntu:~$ vdirsyncer discover my_calendar -vdebug
Usage: vdirsyncer discover [OPTIONS] [PAIRS]...
Try 'vdirsyncer discover -h' for help.

vdirsyncer sync asks me to run the previous command, and no change seen anywhere in the calendar.

@oz123

oz123 commented Jun 16, 2026

Copy link
Copy Markdown
Author

Thanks for testing!
Ok, vdirsyncher is confusing.
I will update the documentation of getting started with it.
As for storing the password -
First, the files should be saved with chmod 600 ( or by setting umask. Both are actually steps that are overlooked or easily forgotten. We can add it too. Additionally, vdirsyncher supports password.fetch` so users running gnome-keyring can do:

$ keyring set mycalendar.com myuser
>TypePasswordinPrompt

Then in the configuration:

[storage foo]
type = "caldav"
url = "https://mycalendar.com/dav/"
username = "myuser"
password.fetch = ["command", "keyring", "get", "mycalendar.com/", "myuser"]

It replicates vdirsyncher documentation in here, but it's going to spare a few minutes for users of mate desktop and make it more secure. I can add it too.

@lukefromdc

lukefromdc commented Jun 16, 2026 via email

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants