Commit Graph
27 Commits
Author SHA1 Message Date
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
Michael Catanzaro 20509d2ac8 flatpak: Follow libhandy-0-0 2020-02-18 23:07:14 +00:00
Michael Catanzaro 9766cd1858 Fix app ID outside devel profile
We accidentally have a trailing period here except when the Devel
profile is selected, which is not a valid app ID.
2019-12-06 14:06:41 -06:00
Michael Catanzaro e053c0cae8 quick-add-popover: Use more g_signal_connect_object
We need to disconnect from the GcalManager when the GcalQuickAddPopover
is destroyed, or crashes happen.
2019-10-07 10:37:50 -05:00
Michael Catanzaro cb14c3f46c Fix double free in gcal_quick_add_popover_set_property
This already uses an autoptr.

Fixes #455
2019-09-21 16:06:48 +00:00
Michael Catanzaro 50b6d00784 manager: add GcalContext property
This improves access to the GcalContext inside GcalManager.

Also, remove test-manager since it only tests that gcal_manager_new()
returns non-NULL.
2019-09-19 16:04:04 -05: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
Michael Catanzaro d0d4166d23 context: initialize GcalSearchEngine later
After the next commit, GcalSearchEngine will require GcalContext to be
ready to initialize itself.
2019-09-19 15:37:45 -05:00
Michael Catanzaro 18ae67cb59 Use more g_signal_connect_object()
Most of these are probably paranoid, not bugs. I haven't done an
exhaustive review to see what really needs it: that would be
time-consuming and require significant familiarity with the Calendar
codebase. This was just a quick check. Anyway, I vote for paranoid
when it comes to using g_signal_connect() regardless. It's dangerous,
and there's no reason to ever leave a signal connected after the user
data object has been destroyed.

Fixes #423
2019-09-14 23:28:42 +00:00
Michael Catanzaro 5d2c0faf41 Fix use-after-free in GcalManager code
This was originally discovered and fixed by Milan Crha; I'm just
forward-porting his fix to the master branch. self->clients takes
ownership of this source but we don't currently have ownership here,
leading to a double free vulnerability.

Fixes #435
2019-09-03 12:07:26 +00:00
Michael Catanzaro 748b7207e7 Don't leave dangling pointers in the GcalEvent cache
The cache has an unowned pointer to the GcalEvent's UID. We need to
update the cache with the GcalEvent's new UID to avoid use-after-free.

Fixes #434
2019-08-25 17:39:01 +03:00
Michael Catanzaro 34c062a7fa Fix crash in update_default_calendar_row()
It's wrong to call set_row() with NULL row.

Fixes #422
2019-07-10 01:01:42 +00: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
Michael Catanzaro 223ed62034 weather-service: Fix buffer overflow in get_icon_name_sortkey()
We can just use strlen() here.

Fixes #425
2019-07-09 21:48:11 -03:00
Michael Catanzaro 04053dbf47 weather-service: Properly disconnect from GWeatherInfo
We fail to disconnect from the GWeatherInfo in both update_location()
and dispose. We have to fix update_location() manually. To avoid the
need to disconnect in dispose, we can just use g_signal_connect_object().
2019-07-09 21:26:22 -03:00
Michael Catanzaro 3ed9669c6e week-header: Remove internal weather service
self->weather_service was only partially removed in 01fdf79e6a,
leading to a guaranteed crash when the weather is updated because
self->weather_service is now always NULL.

Fixes #397
2019-07-09 21:14:23 -03:00
Michael Catanzaro 44912d9327 Prepare 3.33.1 2019-06-20 19:53:03 -05:00
Michael Catanzaro 6a7cbf2d9f Fixup for the previous commit
e-d-s has added an autoptr type for only one of the two types we use
from e-d-s.

Related to https://gitlab.gnome.org/GNOME/evolution-data-server/issues/73
2019-01-14 13:29:52 -06:00
Michael Catanzaro e6d248699e Fix build against new eds
This build failure was surfaced by
https://gitlab.gnome.org/GNOME/evolution-data-server/issues/73, but
gnome-calendar is at fault for defining autoptrs for types it doesn't
control.
2019-01-14 12:48:26 -06:00
Michael Catanzaro b378c672df Don't claim to support opening ICS files
Calendar doesn't use %U and can't open files on command line, so it shouldn't claim to.

Fixes #313
2018-09-18 14:01:02 +00:00
Michael Catanzaro 0724d4092e event: Save local time correctly
The old code here was not setting tzid correctly. It me took hours to
figure out how to do this, but it turned out to be simple once I found
the right place, buried deep in the e-d-s source code.

Now, ideally we would not change the timezone of the event every time we
edit it. But some big changes in how GNOME Calendar tracks timezone are
going to be required if we do that. In particular, I believe we would
have to stop saving all day events in UTC, and give up on using
GDateTime as we do now, and track timezone completely separately
everywhere using icaltimezone. This is what e-d-s does, and it's
probably what we should be doing too. But that would be a big change.
This commit solves the basic problem, which is to ensure the event is
scheduled for the right time, regardless of timezone.

This finally completely fixes #168.
2017-12-05 21:54:39 -06:00
Michael Catanzaro a7304ed9b0 event: Restore handling of all day events
This brings back the original handling of all day events that we had
before I reverted the previous commit.
2017-12-05 21:54:39 -06:00
Michael Catanzaro 281ed44f1c Revert "event: correctly store timezones"
This reverts commit ce2c955269.

This commit is not right. Lots of code in Calendar relies on being able
to set the timezone of a GcalEvent, and this results in us always
ignoring the timezone set by Calendar in preference to whatever happened
to be in the ECalComponentDateTime previously. That might not be so bad,
but additionally, the time is not adjusted accordingly, so this actually
results in the time of events changing unexpectedly from what Calendar
is trying to set.

The code to explicitly store UTC times for all day events is OK (I
guess) and will be restored in a subsequent commit.
2017-12-05 21:54:39 -06:00
Michael Catanzaro 1d8a164634 event: Fix changing the timezone
g_date_time_equal() corrects for timezone offsets to ensure that, e.g.,
6 AM CST is treated as equal to 12 PM UTC. This means attempts to change
the start and end times of events to the same time in another timezone
are currently failing. We need to remove this attempt at optimization
because it prevents gcal_event_set_timezone() from ever doing anything.
2017-12-05 21:53:00 -06:00
Michael Catanzaro 8740ca2df1 event-widget: Fix time in tooltip text
The tooltips think all events start and end between 1:00 and 1:59,
because we are missing a % in the format string and the I looks like 1.

I like it when bugs turn out to be easy. Fixes #225.
2017-12-05 21:50:32 -06:00
Michael Catanzaro ce8e8c217e edit-dialog: Fix timezone for events created in month view
In month view, when clicking on a day of the month, every event is
initially an All Day event until the user opens the Edit Details dialog
and unchecks the checkbox. This means that the event is originally
created in UTC time, and needs to be explicitly switched to local time.
2017-12-05 16:28:18 -06:00
Michael Catanzaro 2cca96c349 event: Fix a minor leak 2017-12-05 13:36:29 -06:00