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.
This commit is contained in:
Erick Pérez Castellanos
2015-02-06 09:21:35 -05:00
parent 7d7ded58aa
commit 158523bb6b
+34
View File
@@ -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);
}
}