From 158523bb6b3f887e5d8d2fb78d13cb9492019833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Thu, 5 Feb 2015 17:06:57 -0500 Subject: [PATCH] window: wait for callbacks execution When the date has been just moved, the ECalDataModel callbacks has not had time to execute so the vie wis empty. Schedule a request to allow the callbacks execution. --- src/gcal-window.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/gcal-window.c b/src/gcal-window.c index 8f28ec3b..dc2adece 100644 --- a/src/gcal-window.c +++ b/src/gcal-window.c @@ -44,6 +44,11 @@ struct _NewEventData }; typedef struct _NewEventData NewEventData; +typedef struct +{ + GcalWindow *window; + gchar *uuid; +} OpenEditDialogData; typedef struct { @@ -1154,6 +1159,28 @@ undo_remove_event (GtkButton *button, } +static gboolean +schedule_open_edit_dialog_by_uuid (OpenEditDialogData *edit_dialog_data) +{ + GcalWindowPrivate *priv; + GList *widgets; + + priv = gcal_window_get_instance_private (edit_dialog_data->window); + widgets = gcal_view_get_children_by_uuid (GCAL_VIEW (priv->month_view), edit_dialog_data->uuid); + if (widgets != NULL) + { + event_activated (NULL, widgets->data, edit_dialog_data->window); + g_list_free (widgets); + g_free (edit_dialog_data->uuid); + g_free (edit_dialog_data); + return FALSE; + } + else + { + return TRUE; + } +} + static void gcal_window_class_init(GcalWindowClass *klass) { @@ -1576,4 +1603,11 @@ gcal_window_open_event_by_uuid (GcalWindow *window, event_activated (NULL, widgets->data, window); g_list_free (widgets); } + else + { + OpenEditDialogData *edit_dialog_data = g_new0 (OpenEditDialogData, 1); + edit_dialog_data->window = window; + edit_dialog_data->uuid = g_strdup (uuid); + g_timeout_add_seconds (2, (GSourceFunc) schedule_open_edit_dialog_by_uuid, edit_dialog_data); + } }