diff --git a/core/Utils.vala b/core/Utils.vala
index 7dd423526..6aaf9f2f0 100644
--- a/core/Utils.vala
+++ b/core/Utils.vala
@@ -225,32 +225,23 @@ namespace Maya.Util {
}
public bool calcomp_is_on_day (ECal.Component comp, GLib.DateTime day) {
- ECal.ComponentDateTime start_dt;
- ECal.ComponentDateTime end_dt;
-
#if E_CAL_2_0
- start_dt = comp.get_dtstart ();
- end_dt = comp.get_dtend ();
+ unowned ICal.Timezone system_timezone = ECal.util_get_system_timezone ();
#else
- comp.get_dtstart (out start_dt);
- comp.get_dtend (out end_dt);
+ unowned ICal.Timezone system_timezone = ECal.Util.get_system_timezone ();
#endif
var stripped_time = new DateTime.local (day.get_year (), day.get_month (), day.get_day_of_month (), 0, 0, 0);
var selected_date_unix = stripped_time.to_unix ();
var selected_date_unix_next = stripped_time.add_days (1).to_unix ();
- time_t start_unix;
- time_t end_unix;
/* We want to be relative to the local timezone */
-#if E_CAL_2_0
- start_unix = start_dt.get_value ().as_timet_with_zone (ECal.util_get_system_timezone ());
- end_unix = end_dt.get_value ().as_timet_with_zone (ECal.util_get_system_timezone ());
-#else
- start_unix = (*start_dt.value).as_timet_with_zone (ECal.Util.get_system_timezone ());
- end_unix = (*end_dt.value).as_timet_with_zone (ECal.Util.get_system_timezone ());
-#endif
+ unowned ICal.Component? icomp = comp.get_icalcomponent ();
+ ICal.Time? start_time = icomp.get_dtstart ();
+ ICal.Time? end_time = icomp.get_dtend ();
+ time_t start_unix = start_time.as_timet_with_zone (system_timezone);
+ time_t end_unix = end_time.as_timet_with_zone (system_timezone);
/* If the selected date is inside the event */
if (start_unix < selected_date_unix && selected_date_unix_next < end_unix) {
diff --git a/data/io.elementary.calendar.appdata.xml.in b/data/io.elementary.calendar.appdata.xml.in
index c0af57e77..22ea07d03 100644
--- a/data/io.elementary.calendar.appdata.xml.in
+++ b/data/io.elementary.calendar.appdata.xml.in
@@ -13,6 +13,11 @@
+
+
+ Fix potential crash when loading events with no start or end time
+
+
Make agenda pane fill the whole space
diff --git a/src/Widgets/EventMenu.vala b/src/Widgets/EventMenu.vala
index cf59662ee..f20c74bc4 100644
--- a/src/Widgets/EventMenu.vala
+++ b/src/Widgets/EventMenu.vala
@@ -66,7 +66,7 @@ public class Maya.EventMenu : Gtk.Menu {
}
private void add_exception () {
- ECal.ComponentDateTime dtstart;
+ ECal.ComponentDateTime? dtstart;
GLib.SList? exdate_list;
#if E_CAL_2_0
dtstart = comp.get_dtstart ();
@@ -76,7 +76,7 @@ public class Maya.EventMenu : Gtk.Menu {
#else
comp.get_dtstart (out dtstart);
comp.get_exdate_list (out exdate_list);
- exdate_list.append (dtstart);
+ exdate_list.append ((owned) dtstart);
comp.set_exdate_list (exdate_list);
#endif
diff --git a/vapi/libecal-1.2.vapi b/vapi/libecal-1.2.vapi
index f480ee693..d1dcb5c93 100644
--- a/vapi/libecal-1.2.vapi
+++ b/vapi/libecal-1.2.vapi
@@ -131,42 +131,42 @@ namespace ECal {
public string get_as_string ();
public void get_attachment_list (out GLib.SList attachment_list);
public void get_attendee_list (out GLib.SList attendee_list);
- public void get_categories (out string categories);
+ public void get_categories (out string? categories);
public void get_categories_list (out GLib.SList categ_list);
- public void get_classification (out ECal.ComponentClassification classif);
+ public void get_classification (out ECal.ComponentClassification? classif);
public void get_comment_list (out GLib.SList text_list);
- public void get_completed (out ICal.Time t);
+ public void get_completed (out ICal.Time? t);
public void get_contact_list (out GLib.SList text_list);
- public void get_created (out ICal.Time t);
+ public void get_created (out ICal.Time? t);
public void get_description_list (out GLib.SList text_list);
- public void get_dtend (out ECal.ComponentDateTime dt);
- public void get_dtstamp (out ICal.Time t);
- public void get_dtstart (out ECal.ComponentDateTime dt);
- public void get_due (out ECal.ComponentDateTime dt);
+ public void get_dtend (out ECal.ComponentDateTime? dt);
+ public void get_dtstamp (out ICal.Time? t);
+ public void get_dtstart (out ECal.ComponentDateTime? dt);
+ public void get_due (out ECal.ComponentDateTime? dt);
public void get_exdate_list (out GLib.SList exdate_list);
public void get_exrule_list (out GLib.SList recur_list);
public void get_exrule_property_list (out GLib.SList recur_list);
- public void get_geo (out ICal.Geo geo);
+ public void get_geo (out ICal.Geo? geo);
public unowned ICal.Component get_icalcomponent ();
public ECal.ComponentId get_id ();
- public void get_last_modified (out ICal.Time t);
- public void get_location (out string location);
+ public void get_last_modified (out ICal.Time? t);
+ public void get_location (out string? location);
public int get_num_attachments ();
- public void get_organizer (out ECal.ComponentOrganizer organizer);
- public void get_percent (out int percent);
+ public void get_organizer (out ECal.ComponentOrganizer? organizer);
+ public void get_percent (out int? percent);
public int get_percent_as_int ();
- public void get_priority (out int priority);
+ public void get_priority (out int? priority);
public void get_rdate_list (out GLib.SList period_list);
- public void get_recurid (out ECal.ComponentRange recur_id);
+ public void get_recurid (out ECal.ComponentRange? recur_id);
public string get_recurid_as_string ();
public void get_rrule_list (out GLib.SList recur_list);
public void get_rrule_property_list (out GLib.SList recur_list);
- public void get_sequence (out int sequence);
- public void get_status (out ICal.PropertyStatus status);
+ public void get_sequence (out int? sequence);
+ public void get_status (out ICal.PropertyStatus? status);
public ECal.ComponentText get_summary ();
- public void get_transparency (out ECal.ComponentTransparency transp);
+ public void get_transparency (out ECal.ComponentTransparency? transp);
public void get_uid (out string uid);
- public void get_url (out string url);
+ public void get_url (out string? url);
public ECal.ComponentVType get_vtype ();
public bool has_alarms ();
public bool has_attachments ();
@@ -309,8 +309,12 @@ namespace ECal {
}
[CCode (cheader_filename = "libecal/libecal.h", free_function = "e_cal_component_free_datetime")]
public struct ComponentDateTime {
- public ICal.Time* value;
+ public ICal.Time? value;
public weak string tzid;
+ [CCode (cname = "_vala_e_cal_component_get_value")]
+ public unowned ICal.Time? get_value () {
+ return value;
+ }
}
[CCode (cheader_filename = "libecal/libecal.h", copy_function = "g_boxed_copy", free_function = "g_boxed_free", type_id = "e_cal_component_id_get_type ()")]
[Compact]
diff --git a/vapi/libical.vapi b/vapi/libical.vapi
index c09f107d7..61a4fa985 100644
--- a/vapi/libical.vapi
+++ b/vapi/libical.vapi
@@ -1991,7 +1991,7 @@ namespace ICal {
[CCode (cname = "is_date")]
public int _is_date;
public int is_daylight;
- public weak ICal.Timezone zone;
+ public weak ICal.Timezone? zone;
[CCode (cname = "icaltime_today", has_construct_function = false)]
public ICal.Time.today ();
[CCode (cname = "icaltime_from_day_of_year", has_construct_function = false)]