Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions core/Services/Calendar/EventStore.vala
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,35 @@ public class Calendar.EventStore : Object {
return true;
}

public ECal.Component get_master_component (E.Source source, ECal.Component event) {
if (event.get_icalcomponent ().get_recurrenceid ().is_null_time ()) {
return event;
}

ECal.Client? client;
lock (source_client) {
client = source_client.get (source.get_uid ());
}

if (client == null) {
warning ("No calendar client found for source '%s'", source.dup_display_name ());
return event;
}

try {
ICal.Component icalcomp;
client.get_object_sync (event.get_id ().get_uid (), null, out icalcomp);

var master = new ECal.Component.from_icalcomponent (icalcomp);
master.set_data<E.Source> ("source", source);

return master;
} catch (Error error) {
warning ("Could not retrieve master event: %s", error.message);
return event;
}
}

private async void add_event_async (E.Source source, ECal.Component event) {
unowned ICal.Component comp = event.get_icalcomponent ();
debug (@"Adding event '$(comp.get_uid())'");
Expand Down
3 changes: 2 additions & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ public class Maya.MainWindow : Gtk.ApplicationWindow {
E.Source src = comp.get_data ("source");

if (src.writable == true && Calendar.EventStore.get_default ().calclient_is_readonly (src) == false) {
var dialog = new Maya.View.EventDialog (comp, null, this);
var event = Calendar.EventStore.get_default ().get_master_component (src, comp);
var dialog = new Maya.View.EventDialog (event, null, this);
dialog.present ();
} else {
Gdk.Display.get_default ().beep ();
Expand Down
Loading