Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package gnome-calendar for openSUSE:Factory checked in at 2021-12-13 20:45:18 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gnome-calendar (Old) and /work/SRC/openSUSE:Factory/.gnome-calendar.new.2520 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gnome-calendar" Mon Dec 13 20:45:18 2021 rev:40 rq:940308 version:41.2 Changes: -------- --- /work/SRC/openSUSE:Factory/gnome-calendar/gnome-calendar.changes 2021-11-08 17:25:15.904735895 +0100 +++ /work/SRC/openSUSE:Factory/.gnome-calendar.new.2520/gnome-calendar.changes 2021-12-13 20:51:36.940681722 +0100 @@ -1,0 +2,7 @@ +Fri Dec 10 21:29:43 UTC 2021 - Bj??rn Lie <bjorn....@gmail.com> + +- Update to version 41.2: + + Various fixes to timezone handling. + + Updated translations. + +------------------------------------------------------------------- Old: ---- gnome-calendar-41.1.tar.xz New: ---- gnome-calendar-41.2.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gnome-calendar.spec ++++++ --- /var/tmp/diff_new_pack.2BmtJ9/_old 2021-12-13 20:51:37.392682012 +0100 +++ /var/tmp/diff_new_pack.2BmtJ9/_new 2021-12-13 20:51:37.396682014 +0100 @@ -17,7 +17,7 @@ Name: gnome-calendar -Version: 41.1 +Version: 41.2 Release: 0 Summary: A calendar application for GNOME License: GPL-3.0-or-later ++++++ gnome-calendar-41.1.tar.xz -> gnome-calendar-41.2.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/NEWS new/gnome-calendar-41.2/NEWS --- old/gnome-calendar-41.1/NEWS 2021-11-05 21:57:02.033266500 +0100 +++ new/gnome-calendar-41.2/NEWS 2021-12-10 21:15:18.198809900 +0100 @@ -1,3 +1,7 @@ +Major changes in 41.2: +* Various fixes to timezone handling +* Updated translations + Major changes in 41.1: * Fix Google Meet URL detection * Updated translations diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/data/appdata/org.gnome.Calendar.appdata.xml.in.in new/gnome-calendar-41.2/data/appdata/org.gnome.Calendar.appdata.xml.in.in --- old/gnome-calendar-41.1/data/appdata/org.gnome.Calendar.appdata.xml.in.in 2021-11-05 21:57:02.034266500 +0100 +++ new/gnome-calendar-41.2/data/appdata/org.gnome.Calendar.appdata.xml.in.in 2021-12-10 21:15:18.201810000 +0100 @@ -45,6 +45,7 @@ <project_group>GNOME</project_group> <releases> + <release date="2021-12-10" version="41.2" /> <release date="2021-11-05" version="41.1"> <description> <p> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/meson.build new/gnome-calendar-41.2/meson.build --- old/gnome-calendar-41.1/meson.build 2021-11-05 21:57:02.036266600 +0100 +++ new/gnome-calendar-41.2/meson.build 2021-12-10 21:15:18.209810300 +0100 @@ -1,7 +1,7 @@ project( 'gnome-calendar', 'c', - version: '41.1', + version: '41.2', license: 'GPL3+', meson_version: '>= 0.53.0' ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/core/gcal-event.c new/gnome-calendar-41.2/src/core/gcal-event.c --- old/gnome-calendar-41.1/src/core/gcal-event.c 2021-11-05 21:57:02.051267000 +0100 +++ new/gnome-calendar-41.2/src/core/gcal-event.c 2021-12-10 21:15:18.237810900 +0100 @@ -148,11 +148,12 @@ } static GTimeZone* -get_timezone_from_ical (ECalComponentDateTime *comp) +get_timezone_from_ical (GcalEvent *self, + ECalComponentDateTime *comp) { + g_autoptr (GTimeZone) tz = NULL; ICalTimezone *zone; ICalTime *itt; - GTimeZone *tz; itt = e_cal_component_datetime_get_value (comp); zone = i_cal_time_get_timezone (itt); @@ -168,16 +169,29 @@ } else if (e_cal_component_datetime_get_tzid (comp)) { - const gchar *real_tzid; + const gchar *original_tzid, *tzid; - real_tzid = e_cal_component_datetime_get_tzid (comp); + tzid = e_cal_component_datetime_get_tzid (comp); + original_tzid = tzid; - if (g_str_has_prefix (real_tzid, LIBICAL_TZID_PREFIX)) - real_tzid += strlen (LIBICAL_TZID_PREFIX); + if (g_str_has_prefix (tzid, LIBICAL_TZID_PREFIX)) + tzid += strlen (LIBICAL_TZID_PREFIX); - tz = g_time_zone_new_identifier (real_tzid); + tz = g_time_zone_new_identifier (tzid); + + if (!tz && self->calendar) + { + ICalTimezone *tzone = NULL; + ECalClient *client; + + client = gcal_calendar_get_client (self->calendar); + + if (client && e_cal_client_get_timezone_sync (client, original_tzid, &tzone, NULL, NULL)) + zone = tzone; + } } - else if (zone) + + if (!tz && zone) { g_autofree gchar *tzid = NULL; gint offset; @@ -186,10 +200,6 @@ tzid = format_utc_offset (offset); tz = g_time_zone_new_identifier (tzid); } - else - { - tz = g_time_zone_new_utc (); - } /* * If tz is NULL, the timezone identifier is invalid. Fallback to UTC @@ -200,7 +210,7 @@ GCAL_TRACE_MSG ("%s (%p)", g_time_zone_get_identifier (tz), tz); - return tz; + return g_steal_pointer (&tz); } static ECalComponentDateTime* @@ -340,7 +350,7 @@ GCAL_TRACE_MSG ("Retrieving start timezone"); date = i_cal_time_normalize (e_cal_component_datetime_get_value (start)); - zone_start = get_timezone_from_ical (start); + zone_start = get_timezone_from_ical (self, start); date_start = g_date_time_new (zone_start, i_cal_time_get_year (date), i_cal_time_get_month (date), @@ -366,7 +376,7 @@ GCAL_TRACE_MSG ("Retrieving end timezone"); date = i_cal_time_normalize (e_cal_component_datetime_get_value (end)); - zone_end = get_timezone_from_ical (end); + zone_end = get_timezone_from_ical (self, end); date_end = g_date_time_new (zone_end, i_cal_time_get_year (date), i_cal_time_get_month (date), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/event-editor/gcal-schedule-section.c new/gnome-calendar-41.2/src/gui/event-editor/gcal-schedule-section.c --- old/gnome-calendar-41.1/src/gui/event-editor/gcal-schedule-section.c 2021-11-05 21:57:02.057267000 +0100 +++ new/gnome-calendar-41.2/src/gui/event-editor/gcal-schedule-section.c 2021-12-10 21:15:18.249811400 +0100 @@ -220,6 +220,7 @@ gboolean all_day) { g_autofree gchar *formatted_date = NULL; + g_autoptr (GDateTime) local_dt = NULL; g_autoptr (GDateTime) now = NULL; GString *string; gint days_diff; @@ -227,7 +228,8 @@ string = g_string_new (""); now = g_date_time_new_now_local (); - days_diff = gcal_date_time_compare_date (date, now); + local_dt = all_day ? g_date_time_ref (date) : g_date_time_to_local (date); + days_diff = gcal_date_time_compare_date (local_dt, now); switch (days_diff) { @@ -238,7 +240,7 @@ case -3: case -2: /* Translators: %A is the weekday name (e.g. Sunday, Monday, etc) */ - formatted_date = g_date_time_format (date, _("Last %A")); + formatted_date = g_date_time_format (local_dt, _("Last %A")); break; case -1: @@ -260,11 +262,11 @@ case 6: case 7: /* Translators: %A is the weekday name (e.g. Sunday, Monday, etc) */ - formatted_date = g_date_time_format (date, _("This %A")); + formatted_date = g_date_time_format (local_dt, _("This %A")); break; default: - formatted_date = g_date_time_format (date, "%x"); + formatted_date = g_date_time_format (local_dt, "%x"); break; } @@ -275,11 +277,11 @@ switch (format) { case GCAL_TIME_FORMAT_12H: - formatted_time = g_date_time_format (date, "%I:%M %P"); + formatted_time = g_date_time_format (local_dt, "%I:%M %P"); break; case GCAL_TIME_FORMAT_24H: - formatted_time = g_date_time_format (date, "%R"); + formatted_time = g_date_time_format (local_dt, "%R"); break; default: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/gcal-application.c new/gnome-calendar-41.2/src/gui/gcal-application.c --- old/gnome-calendar-41.1/src/gui/gcal-application.c 2021-11-05 21:57:02.058266900 +0100 +++ new/gnome-calendar-41.2/src/gui/gcal-application.c 2021-12-10 21:15:18.251811300 +0100 @@ -412,7 +412,7 @@ g_autoptr (GDateTime) initial_date = NULL; initial_date = g_date_time_new (gcal_context_get_timezone (self->context), - result.tm_year, + result.tm_year + 1900, result.tm_mon, result.tm_mday, result.tm_hour, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/gcal-event-popover.c new/gnome-calendar-41.2/src/gui/gcal-event-popover.c --- old/gnome-calendar-41.1/src/gui/gcal-event-popover.c 2021-11-05 21:57:02.058266900 +0100 +++ new/gnome-calendar-41.2/src/gui/gcal-event-popover.c 2021-12-10 21:15:18.251811300 +0100 @@ -352,9 +352,9 @@ static void update_date_time_label (GcalEventPopover *self) { + g_autoptr (GDateTime) start_dt = NULL; + g_autoptr (GDateTime) end_dt = NULL; g_autoptr (GString) string = NULL; - GDateTime *end_dt; - GDateTime *start_dt; gboolean show_hours; gboolean multiday; gboolean all_day; @@ -364,8 +364,16 @@ multiday = gcal_event_is_multiday (self->event); show_hours = !all_day; - end_dt = gcal_event_get_date_end (self->event); - start_dt = gcal_event_get_date_start (self->event); + if (all_day) + { + start_dt = g_date_time_ref (gcal_event_get_date_start (self->event)); + end_dt = g_date_time_ref (gcal_event_get_date_end (self->event)); + } + else + { + start_dt = g_date_time_to_local (gcal_event_get_date_start (self->event)); + end_dt = g_date_time_to_local (gcal_event_get_date_end (self->event)); + } if (multiday) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/importer/gcal-import-dialog.c new/gnome-calendar-41.2/src/gui/importer/gcal-import-dialog.c --- old/gnome-calendar-41.1/src/gui/importer/gcal-import-dialog.c 2021-11-05 21:57:02.061267000 +0100 +++ new/gnome-calendar-41.2/src/gui/importer/gcal-import-dialog.c 2021-12-10 21:15:18.255811500 +0100 @@ -29,6 +29,13 @@ #include <glib/gi18n.h> +typedef struct +{ + ECalClient *client; + GSList *components; + GSList *zones; +} ImportData; + struct _GcalImportDialog { HdyWindow parent; @@ -84,6 +91,20 @@ * Auxiliary methods */ +static void +import_data_free (gpointer data) +{ + ImportData *import_data = data; + + if (!import_data) + return; + + g_clear_object (&import_data->client); + g_slist_free_full (import_data->components, g_object_unref); + g_slist_free_full (import_data->zones, g_object_unref); + g_free (import_data); +} + static GtkWidget* create_calendar_row (GcalManager *manager, GcalCalendar *calendar) @@ -252,7 +273,7 @@ self = GCAL_IMPORT_DIALOG (user_data); - e_cal_client_create_objects_finish (E_CAL_CLIENT (source_object), result, NULL, &error); + g_task_propagate_boolean (G_TASK (result), &error); if (error) g_warning ("Error creating events: %s", error->message); @@ -282,13 +303,53 @@ } static void +import_data_thread (GTask *task, + gpointer source_object, + gpointer task_data, + GCancellable *cancellable) +{ + ImportData *id = task_data; + GError *error = NULL; + GSList *uids = NULL; + GSList *l = NULL; + + for (l = id->zones; l && !g_cancellable_is_cancelled (cancellable); l = l->next) + { + g_autoptr (GError) local_error = NULL; + ICalTimezone *zone = l->data; + + e_cal_client_add_timezone_sync (id->client, zone, cancellable, &local_error); + + if (local_error) + g_warning ("Import: Failed to add timezone: %s", local_error->message); + } + + e_cal_client_create_objects_sync (id->client, + id->components, + E_CAL_OPERATION_FLAG_NONE, + &uids, + cancellable, + &error); + + g_slist_free_full (uids, g_free); + + if (error) + g_task_return_error (task, error); + else + g_task_return_boolean (task, TRUE); +} + +static void on_import_button_clicked_cb (GtkButton *button, GcalImportDialog *self) { g_autoptr (GList) children = NULL; + g_autoptr (GTask) task = NULL; GcalCalendar *calendar; + ImportData *import_data; ECalClient *client; - GSList *slist; + GSList *slist = NULL; + GSList *zones = NULL; GList *l; GCAL_ENTRY; @@ -302,6 +363,7 @@ { GcalImportFileRow *row = l->data; GPtrArray *ical_components; + GPtrArray *ical_timezones; guint i; ical_components = gcal_import_file_row_get_ical_components (row); @@ -309,7 +371,20 @@ continue; for (i = 0; i < ical_components->len; i++) - slist = g_slist_prepend (slist, g_ptr_array_index (ical_components, i)); + { + ICalComponent *comp = g_ptr_array_index (ical_components, i); + slist = g_slist_prepend (slist, g_object_ref (comp)); + } + + ical_timezones = gcal_import_file_row_get_timezones (row); + if (!ical_timezones) + continue; + + for (i = 0; i < ical_timezones->len; i++) + { + ICalTimezone *zone = g_ptr_array_index (ical_timezones, i); + zones = g_slist_prepend (zones, g_object_ref (zone)); + } } if (!slist) @@ -320,12 +395,16 @@ gtk_widget_set_sensitive (GTK_WIDGET (self), FALSE); client = gcal_calendar_get_client (calendar); - e_cal_client_create_objects (client, - slist, - E_CAL_OPERATION_FLAG_NONE, - self->cancellable, - on_events_created_cb, - self); + + import_data = g_new0 (ImportData, 1); + import_data->client = g_object_ref (client); + import_data->components = g_slist_reverse (slist); + import_data->zones = g_slist_reverse (zones); + + task = g_task_new (NULL, self->cancellable, on_events_created_cb, self); + g_task_set_task_data (task, import_data, import_data_free); + g_task_set_source_tag (task, on_import_button_clicked_cb); + g_task_run_in_thread (task, import_data_thread); GCAL_EXIT; } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/importer/gcal-import-file-row.c new/gnome-calendar-41.2/src/gui/importer/gcal-import-file-row.c --- old/gnome-calendar-41.1/src/gui/importer/gcal-import-file-row.c 2021-11-05 21:57:02.061267000 +0100 +++ new/gnome-calendar-41.2/src/gui/importer/gcal-import-file-row.c 2021-12-10 21:15:18.255811500 +0100 @@ -38,6 +38,7 @@ GCancellable *cancellable; GFile *file; GPtrArray *ical_components; + GPtrArray *ical_timezones; }; static void read_calendar_finished_cb (GObject *source_object, @@ -212,6 +213,37 @@ return g_steal_pointer (&event_components); } +static GPtrArray* +filter_timezones (ICalComponent *component) +{ + g_autoptr (GPtrArray) timezones = NULL; + ICalComponent *aux; + + if (!component || i_cal_component_isa (component) != I_CAL_VCALENDAR_COMPONENT) + return NULL; + + timezones = g_ptr_array_new_full (2, g_object_unref); + for (aux = i_cal_component_get_first_component (component, I_CAL_VTIMEZONE_COMPONENT); + aux; + aux = i_cal_component_get_next_component (component, I_CAL_VTIMEZONE_COMPONENT)) + { + ICalTimezone *zone = i_cal_timezone_new (); + ICalComponent *clone = i_cal_component_clone (aux); + + if (i_cal_timezone_set_component (zone, clone)) + g_ptr_array_add (timezones, g_steal_pointer (&zone)); + + g_clear_object (&clone); + g_clear_object (&zone); + g_clear_object (&aux); + } + + if (!timezones->len) + return NULL; + + return g_steal_pointer (&timezones); +} + static void setup_file (GcalImportFileRow *self) { @@ -237,6 +269,7 @@ gpointer user_data) { g_autoptr (GPtrArray) event_components = NULL; + g_autoptr (GPtrArray) timezones = NULL; g_autoptr (GError) error = NULL; g_autofree gchar *subtitle = NULL; ICalComponent *component; @@ -245,6 +278,7 @@ self = GCAL_IMPORT_FILE_ROW (user_data); component = gcal_importer_import_file_finish (res, &error); event_components = filter_event_components (component); + timezones = filter_timezones (component); gtk_widget_set_sensitive (GTK_WIDGET (self), !error && event_components && event_components->len > 0); @@ -254,6 +288,7 @@ add_events_to_listbox (self, event_components); self->ical_components = g_ptr_array_ref (event_components); + self->ical_timezones = g_ptr_array_ref (timezones); g_signal_emit (self, signals[FILE_LOADED], 0, event_components); } @@ -272,6 +307,7 @@ g_clear_object (&self->cancellable); g_clear_object (&self->file); g_clear_pointer (&self->ical_components, g_ptr_array_unref); + g_clear_pointer (&self->ical_timezones, g_ptr_array_unref); G_OBJECT_CLASS (gcal_import_file_row_parent_class)->finalize (object); } @@ -386,3 +422,11 @@ return self->ical_components; } + +GPtrArray* +gcal_import_file_row_get_timezones (GcalImportFileRow *self) +{ + g_return_val_if_fail (GCAL_IS_IMPORT_FILE_ROW (self), NULL); + + return self->ical_timezones; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gnome-calendar-41.1/src/gui/importer/gcal-import-file-row.h new/gnome-calendar-41.2/src/gui/importer/gcal-import-file-row.h --- old/gnome-calendar-41.1/src/gui/importer/gcal-import-file-row.h 2021-11-05 21:57:02.061267000 +0100 +++ new/gnome-calendar-41.2/src/gui/importer/gcal-import-file-row.h 2021-12-10 21:15:18.255811500 +0100 @@ -33,5 +33,6 @@ void gcal_import_file_row_show_filename (GcalImportFileRow *self); GPtrArray* gcal_import_file_row_get_ical_components (GcalImportFileRow *self); +GPtrArray* gcal_import_file_row_get_timezones (GcalImportFileRow *self); G_END_DECLS