window: pop up recurrence-dialog right after edit-dialog

The recurrence-dialog opens only if the event to be modified
is a recurring event and only if the user doesn't cancel
the modification in the edit-dialog. If the user presses
'Cancel' in the recurrence-dialog after making modifications
in the edit-dialog, then no changes are applied.

https://bugzilla.gnome.org/show_bug.cgi?id=782755
This commit is contained in:
Yash Singh
2017-06-10 09:02:31 -03:00
committed by Georges Basile Stavracas Neto
parent a9430f54d0
commit 5a5dc6716a
+21 -5
View File
@@ -150,6 +150,7 @@ struct _GcalWindow
NewEventData *event_creation_data; NewEventData *event_creation_data;
GcalEvent *event_to_delete; GcalEvent *event_to_delete;
ECalObjModType event_to_delete_mod;
/* calendar management */ /* calendar management */
GtkWidget *calendar_popover; GtkWidget *calendar_popover;
@@ -1085,6 +1086,8 @@ edit_dialog_closed (GtkDialog *dialog,
GcalEvent *event; GcalEvent *event;
GcalView *view; GcalView *view;
GList *widgets; GList *widgets;
ECalObjModType mod;
ESource *source;
GCAL_ENTRY; GCAL_ENTRY;
@@ -1092,8 +1095,17 @@ edit_dialog_closed (GtkDialog *dialog,
edit_dialog = GCAL_EDIT_DIALOG (dialog); edit_dialog = GCAL_EDIT_DIALOG (dialog);
event = gcal_edit_dialog_get_event (edit_dialog); event = gcal_edit_dialog_get_event (edit_dialog);
view = GCAL_VIEW (window->views[window->active_view]); view = GCAL_VIEW (window->views[window->active_view]);
mod = E_CAL_OBJ_MOD_THIS;
source = gcal_event_get_source (event);
gtk_widget_hide (GTK_WIDGET (dialog)); if (response != GCAL_RESPONSE_CREATE_EVENT &&
response != GTK_RESPONSE_CANCEL &&
response != GTK_RESPONSE_DELETE_EVENT &&
gcal_event_has_recurrence (event) &&
!ask_recurrence_modification_type (GTK_WIDGET (dialog), &mod, source))
{
return;
}
switch (response) switch (response)
{ {
@@ -1102,13 +1114,13 @@ edit_dialog_closed (GtkDialog *dialog,
break; break;
case GCAL_RESPONSE_SAVE_EVENT: case GCAL_RESPONSE_SAVE_EVENT:
gcal_manager_update_event (window->manager, event, E_CAL_OBJ_MOD_THIS); gcal_manager_update_event (window->manager, event, mod);
break; break;
case GCAL_RESPONSE_DELETE_EVENT: case GCAL_RESPONSE_DELETE_EVENT:
if (window->event_to_delete != NULL) if (window->event_to_delete != NULL)
{ {
gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS); gcal_manager_remove_event (window->manager, window->event_to_delete, window->event_to_delete_mod);
g_clear_object (&window->event_to_delete); g_clear_object (&window->event_to_delete);
create_notification (GCAL_WINDOW (user_data), _("Another event deleted"), _("Undo")); create_notification (GCAL_WINDOW (user_data), _("Another event deleted"), _("Undo"));
@@ -1127,6 +1139,8 @@ edit_dialog_closed (GtkDialog *dialog,
g_set_object (&window->event_to_delete, event); g_set_object (&window->event_to_delete, event);
window->event_to_delete_mod = mod;
/* hide widget of the event */ /* hide widget of the event */
widgets = gcal_view_get_children_by_uuid (view, gcal_event_get_uid (event)); widgets = gcal_view_get_children_by_uuid (view, gcal_event_get_uid (event));
@@ -1140,6 +1154,8 @@ edit_dialog_closed (GtkDialog *dialog,
} }
gtk_widget_hide (GTK_WIDGET (dialog));
gcal_edit_dialog_set_event (edit_dialog, NULL); gcal_edit_dialog_set_event (edit_dialog, NULL);
GCAL_EXIT; GCAL_EXIT;
@@ -1209,7 +1225,7 @@ remove_event (GtkWidget *notification,
if (window->event_to_delete != NULL) if (window->event_to_delete != NULL)
{ {
gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS); gcal_manager_remove_event (window->manager, window->event_to_delete, window->event_to_delete_mod);
g_clear_object (&window->event_to_delete); g_clear_object (&window->event_to_delete);
} }
} }
@@ -1282,7 +1298,7 @@ gcal_window_finalize (GObject *object)
/* If we have a queued event to delete, remove it now */ /* If we have a queued event to delete, remove it now */
if (window->event_to_delete) if (window->event_to_delete)
{ {
gcal_manager_remove_event (window->manager, window->event_to_delete, E_CAL_OBJ_MOD_THIS); gcal_manager_remove_event (window->manager, window->event_to_delete, window->event_to_delete_mod);
g_clear_object (&window->event_to_delete); g_clear_object (&window->event_to_delete);
} }