From 1309bf4a8206b69fc47324c94cf6e16c7fe4d2a1 Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Fri, 28 Feb 2025 18:19:07 -0600 Subject: [PATCH] gcal_schedule_section_set_event(): Don't change the timezones when setting up the widgets I think this was being done so that: - create a new all-day event - open it in the event editor - switch to time-slot - time choosers now say "UTC" doesn't happen. I think this can be handled more gracefully. Evolution does not handle it very gracefully; when turning off all-day in its event editor, it sets the times to $now. The iOS calendar app is better. If you turn all-day off, it picks $next_hour_based_on_now for the start time, and $next_hour_plus_one for the end time. So if you turn off all-day and it is 18:24 right now, it will set the start_time to 19:00 and the end_time to 20:00 --- that is, it creates a one-hour event at the next start of the hour from now. Part-of: --- src/gui/event-editor/gcal-schedule-section.c | 36 +++----------------- 1 file changed, 4 insertions(+), 32 deletions(-) diff --git a/src/gui/event-editor/gcal-schedule-section.c b/src/gui/event-editor/gcal-schedule-section.c index df13904d..1dc26dc5 100644 --- a/src/gui/event-editor/gcal-schedule-section.c +++ b/src/gui/event-editor/gcal-schedule-section.c @@ -445,10 +445,6 @@ gcal_schedule_section_set_event (GcalEventEditorSection *section, GcalEvent *event, GcalEventEditorFlags flags) { - g_autoptr (GDateTime) date_time_start_utc = NULL; - g_autoptr (GDateTime) date_time_end_utc = NULL; - g_autoptr (GDateTime) date_time_start_local = NULL; - g_autoptr (GDateTime) date_time_end_local = NULL; GcalScheduleSection *self; GDateTime* date_time_start = NULL; GDateTime* date_time_end = NULL; @@ -488,41 +484,17 @@ gcal_schedule_section_set_event (GcalEventEditorSection *section, */ date_time_end = all_day ? g_date_time_add_days (date_time_end, -1) : date_time_end; - date_time_start_utc = g_date_time_new_utc (g_date_time_get_year (date_time_start), - g_date_time_get_month (date_time_start), - g_date_time_get_day_of_month (date_time_start), - 0, 0, 0); - - date_time_end_utc = g_date_time_new_utc (g_date_time_get_year (date_time_end), - g_date_time_get_month (date_time_end), - g_date_time_get_day_of_month (date_time_end), - 0, 0, 0); - - date_time_start_local = g_date_time_new_local (g_date_time_get_year (date_time_start), - g_date_time_get_month (date_time_start), - g_date_time_get_day_of_month (date_time_start), - g_date_time_get_hour (date_time_start), - g_date_time_get_minute (date_time_start), - 0); - - date_time_end_local = g_date_time_new_local (g_date_time_get_year (date_time_end), - g_date_time_get_month (date_time_end), - g_date_time_get_day_of_month (date_time_end), - g_date_time_get_hour (date_time_end), - g_date_time_get_minute (date_time_end), - 0); - block_date_signals (self); /* date */ - gcal_date_chooser_row_set_date (self->start_date_row, date_time_start_utc); - gcal_date_chooser_row_set_date (self->end_date_row, date_time_end_utc); + gcal_date_chooser_row_set_date (self->start_date_row, date_time_start); + gcal_date_chooser_row_set_date (self->end_date_row, date_time_end); /* date-time */ if (new_event || all_day) { - gcal_date_time_chooser_set_date_time (self->start_date_time_chooser, date_time_start_local); - gcal_date_time_chooser_set_date_time (self->end_date_time_chooser, date_time_end_local); + gcal_date_time_chooser_set_date_time (self->start_date_time_chooser, date_time_start); + gcal_date_time_chooser_set_date_time (self->end_date_time_chooser, date_time_end); } else {