[gnome-calendar/wip/mcrha/gcal-event-construct: 1/2] gcal-event: Make sure the calendar property is set before the component




commit 55f6e13ae08e960f2308aeeb3fa2740b86794ee8
Author: Milan Crha <mcrha redhat com>
Date:   Wed Feb 2 12:54:31 2022 +0100

    gcal-event: Make sure the calendar property is set before the component
    
    The component times may require to have the calendar set, to be able to lookup
    the custom time zones in the calendar, thus make sure the calendar is set
    before the component is set, during the construction time.
    
    Closes https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/788

 src/core/gcal-event.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/src/core/gcal-event.c b/src/core/gcal-event.c
index 717b4e23..bbeacf83 100644
--- a/src/core/gcal-event.c
+++ b/src/core/gcal-event.c
@@ -117,6 +117,9 @@ G_DEFINE_QUARK (GcalEvent, gcal_event_error);
 
 enum {
   PROP_0,
+  /* Have the calendar as the first, to be available before the component
+     is set, when the object is constructing. */
+  PROP_CALENDAR,
   PROP_ALL_DAY,
   PROP_COLOR,
   PROP_COMPONENT,
@@ -124,7 +127,6 @@ enum {
   PROP_DATE_END,
   PROP_DATE_START,
   PROP_LOCATION,
-  PROP_CALENDAR,
   PROP_RANGE,
   PROP_SUMMARY,
   PROP_TIMEZONE,
@@ -1393,7 +1395,8 @@ gcal_event_set_calendar (GcalEvent    *self,
 
       g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_CALENDAR]);
 
-      gcal_event_update_uid_internal (self);
+      if (self->component != NULL)
+        gcal_event_update_uid_internal (self);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]