Commit Graph
46 Commits
Author SHA1 Message Date
Georges Basile Stavracas Neto 6a5c0229b9 utils: Add boolean flag for showing MOD_ALL
This will be used by next commit to more finely control editing
of recurrent events.
2022-10-17 23:37:13 -03:00
Milan Crha d273b4304f gcal_set_date_time: Avoid possible use-after-free
When the `*dest` and `src` are the same, doing g_date_time_unref()
can free the instance before it's assigned back to the `*dest`.
2022-10-05 15:10:47 +00:00
Milan Crha 0bd11799dc Port to libsoup3 2022-06-22 08:51:30 -03:00
Reynir Björnsson 19b520fa2d source-discoverer: Fail if SoupUri creation fails 2022-06-15 14:10:02 +00:00
nahuelwexd 1de480f102 util: use new GNOME Settings app id 2022-04-07 19:42:50 -03:00
Björn Daase ad7ff65a4d event-editor/schedule-section: Fix localization mix
The gcal_util_translate_time_string function is a plain copy of
gnome-shells shell_util_translate_time_string solving the same problem.

Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/581
2022-02-12 17:43:49 +01:00
Georges Basile Stavracas Neto 69d320f49c event-editor/dialog: Improve calendar selection menu 2022-02-12 13:24:57 -03:00
Georges Basile Stavracas Neto 47a72f8156 event-editor-dialog: Port to new callback-based ask API 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto ee5acbd493 Reimplement event drag n' drop
Reintroduce the code using GTK4 tooling for in-process DnD.
This is looking much better!
2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto fb504db31f util: Drop unused function 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto 1cbce60c4a month-view: Port to GTK4 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto b31b16da17 week-view: Port to GTK4 2022-02-12 13:08:50 -03:00
Georges Basile Stavracas Neto 0f7a0db138 event-editor/dialog: Port to GTK4 2022-02-11 09:18:38 -03:00
Georges Basile Stavracas Neto 2139f40e67 project: Adjust color rendering to use GdkPaintable 2022-02-11 09:18:38 -03:00
Georges Basile Stavracas Neto 41ba168250 calendar-management/calendars-page: Port to GTK4 2022-02-11 09:18:38 -03:00
Markus Hoffmann 7741443c03 utils: Fix Google Meet URL template
The Google Meet URL is extracted from the Calendar Event Notes by using a substring with a fixed length. This length is too short by 1 character.

In order to get the right URL the substring needs to be 1 character longer. In order to match the Google Meet URL add an "x" in the given URL pattern.

Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/749
2021-10-28 13:59:13 +00:00
Georges Basile Stavracas Neto a080d8ec0f utils: Protect against NULL description 2021-08-16 15:27:19 -03:00
Georges Basile Stavracas Neto 01ee4a2b49 utils: Add Google extractor
Google events have an exotic section at the end of their event
descriptions, we can parse that to find some information like
the meeting URL.
2021-06-27 18:36:05 -03:00
Georges Basile Stavracas Neto 64fe7e543c utils/date-time-utils: Use g_time_zone_new_identifier()
g_time_zone_new() is deprecated in favor of it, so use it.
2021-02-26 19:26:49 -03:00
Georges Basile Stavracas Neto 9800fbec4b utils/date-time-utils: Trivial style cleanup 2021-02-26 19:26:49 -03:00
Michael Catanzaro 0733844690 Remove autocleanup for GWeatherLocation with new gweather 2021-01-12 15:08:50 -06:00
Georges Basile Stavracas Neto a146b9050d project: Silence CI warnings 2020-10-31 16:55:06 -03:00
Georges Basile Stavracas Neto eb954505e4 project: Split meson files in subdirs
It allows us to better control what each subdir does, etc. This is
only the first step; we want to also split GResources, etc.
2020-10-30 13:45:50 -03:00
Evangelos Ribeiro Tzaras 07f544b78d gcal-date-time-utils: Fix week start
In locales where the first weekday is a monday, the previous code
had a off by one error determining the week a sunday is in.
The problem ultimately arose because in the
`gcal_date_time_get_start_of_week()` function the variable
`n_days_after_week_start` would become negative (-1 in this case) making
the following `g_date_time_add_days (date, -n_days_after_week_start)`
add 1 day resulting in `start_of_week` being set to the start of the
following week.

The solution was to make sure `n_days_after_week_start` would be
positive by adding 7 to it. The variable is taken modulo 7 hence this
should not introduce any bugs.

Fixes #583
2020-06-15 20:43:55 +02:00
Michael Catanzaro a3e9af23dc source-discoverer: add support for webcal:// URIs
We can implement webcal:// by simply rewriting the URI to https://.
Amazing!

Fixes #564
2020-04-14 15:16:24 -05:00
Georges Basile Stavracas Neto 12fd607d56 utils: Make date comparison follow time comparison semantics
Right now, comparing dates with gcal_date_time_compare_date() gives
the exact opposite result of when comparing using g_date_time_compare().

As shown by this patch, this was a source of *many* bugs.
2020-04-14 19:08:06 +00:00
Georges Basile Stavracas Neto 1f6559de68 Remove ECalDataModel and ECalDataModelSubscriber
Drop the bomb!
2020-04-01 21:06:51 -03:00
Michael Catanzaro a439fd2b1d date-time-utils: fall back to UTC when timezone is unrecognized
For whatever reason, libical doesn't support the Etc/UTC timezone.
Currently we crash gnome-calendar whenever libical doesn't support the
current timezone (as returned by GTimeZone). Let's fall back to UTC
instead.

Fixes #485
2020-02-18 17:07:55 -06:00
Georges Basile Stavracas Neto 34eb3a2343 utils: Use GDate to compare dates 2019-12-02 16:41:56 -03:00
Michael Catanzaro 8e6a3b9f3f Fix crashes when e_cal_util_get_system_timezone() returns NULL
The return value is nullable, but gnome-calendar fails to check it.

Because the nullable return value is inconvenient for us, we can instead
add and use gcal_context_get_icaltimezone() to supplement the existing
gcal_context_get_timezone().

We'll also need a function to convert from GTimeZone to ICalTimezone,
gcal_timezone_to_icaltimezone().

Fixes #419
2019-09-19 16:01:44 -05:00
Georges Basile Stavracas Neto 5e4bbe446f utils: Pass GcalCalendar to ask_recurrence_modification_type()
The method ask_recurrence_modification_type() currently
receives an ESource, and tried to fetch the ECalClient
from the ESource by using g_object_get_data().

However, since we moved to GcalCalendar, we do not set
this data field in ESource.

Receive a GcalCalendar instead, and use the appropriate
function gcal_calendar_get_client() instead.
2019-09-14 21:38:53 -03:00
Georges Basile Stavracas Neto 9644c30eee date-time-utils: Fix weekday calculation
GNOME Calendar needs to deal with two different
weekday ranges:

 1. Sunday → 0 ... Saturday → 6
 2. Monday → 1 ... Sunday → 7 (used by GDateTime)

When converting (2) into (1), the correct calculation
is `weekday % 7`.

However, gcal_date_time_get_start_of_week() was doing
`weekday - 1` instead.

Fix it and do the correct calculation instead.

https://gitlab.gnome.org/GNOME/gnome-calendar/issues/451
2019-09-14 11:14:01 -03:00
Georges Basile Stavracas Neto ff0644ad76 utils: Add auxiliary function to format display names
This will be used by the web source discoverer to format
any URLs that contain a file name in their path.
2019-07-13 16:04:31 -03:00
Georges Basile Stavracas Neto 371fdbc881 Introduce new source discoverer
The new source discoverer is a complete overhaul of
the current code. It is async-only, correctly threaded,
and easier to maintain.

A major new feature of this web source discoverer is
that it now pings the server to see if the URL feeds
us back with an iCalendar file.

Furthermore, it continues to use E-D-S WebDAV discovery
functions as a fallback mechanism.

Fixes #380
2019-07-13 16:04:30 -03:00
Michael Catanzaro 621d69e0bc utils: Use setlocale() in is_workday()
Trying to use environment variables to guess the locale was a good
attempt, but this is tricky because they have to be looked up in a
certain order: first LC_ALL, then fallback to LC_TIME, and finally LANG,
which was missed here. This caused a huge warning spam on the year view
when only LANG is set, and usually only LANG should be set since the
other environment variables are usually used for temporary overrides.
Instead, query the locale using setlocale().

Also, don't assert if the locale is shorter than expected (missing
territory code) since there is at least one valid locale that does not
have any territory codes (Esperanto) and since it's programmer error to
assert when the application processes unexpected input like this.

Fixes #424
2019-07-09 21:52:56 -03:00
Georges Basile Stavracas Neto 8743121f4d source-dialog: Move Online Accounts panel spawn to utils
So that it can be reused by other files.
2019-06-24 21:32:44 -03:00
Milan Crha a0cae4356a Port to libecal-2.0
Fixes https://gitlab.gnome.org/GNOME/gnome-calendar/merge_requests/70
2019-05-17 21:58:55 +02:00
Georges Basile Stavracas Neto 5e3eb40c53 utils: Add gcal_clear_signal_handler 2019-05-04 12:05:39 -03:00
Georges Basile Stavracas Neto 1118c74881 event: Receive and operate on GcalCalendar
Instead of receiving an ESource, receive a GcalCalendar
and operate on it. Many places needed to be adjusted for
that.

Tests need to be rethinked.
2019-05-04 12:05:39 -03:00
Georges Basile Stavracas Neto 0acf0b60ba utils: Receive const GdkRGBA*
We do not modify their values, they're const in
practice already.
2019-05-04 12:05:39 -03:00
Georges Basile Stavracas Neto 907b71635b manager: Move threading functions to utils 2019-04-29 17:08:52 -03:00
Georges Basile Stavracas Neto 6dda74432c utils: Remove more unused functions 2019-04-26 15:42:32 -03:00
Georges Basile Stavracas Neto c52bacfc3f utils: Move more API to gcal-date-time-utils.c 2019-04-26 13:57:05 -03:00
Georges Basile Stavracas Neto ab1c0b6ca4 utils: Rename gcal_clear_datetime to gcal_clear_date_time
To keep it consistent with the rest of the API.
2019-04-26 13:27:37 -03:00
Georges Basile Stavracas Neto 68943eec57 utils: Add GDateTime utils
This will greatly help with the transition to GDateTime.
In the future, we can propose these APIs to GLib itself.
2019-04-26 12:59:29 -03:00
Georges Basile Stavracas Neto 3bff2b8981 utils: Move to utils/ subdir
We will split this file into more, specialized, files
so it makes sense to not pollute the top source dir.
2019-04-25 20:59:08 -03:00