From 06960a27395fd84ca3b3455a9da19e66da1fdc76 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 28 Jan 2005 21:00:06 +0000 Subject: Fixes #71452 2005-01-28 JP Rosevear Fixes #71452 * gui/dialogs/comp-editor.c (setup_widgets): listen for delete_event signal and handle it outside of the response signal so that cancel works properly svn path=/trunk/; revision=28605 --- calendar/gui/dialogs/comp-editor.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'calendar/gui/dialogs') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 012ccecd35..3658500e7f 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -373,7 +373,7 @@ response_cb (GtkWidget *widget, int response, gpointer data) ECalComponentText text; priv = editor->priv; - + switch (response) { case GTK_RESPONSE_OK: commit_all_fields (editor); @@ -395,15 +395,34 @@ response_cb (GtkWidget *widget, int response, gpointer data) break; case GTK_RESPONSE_CANCEL: - case GTK_RESPONSE_DELETE_EVENT: commit_all_fields (editor); if (prompt_to_save_changes (editor, TRUE)) close_dialog (editor); break; + default: + /* We handle delete event below */ + break; } } +static int +delete_event_cb (GtkWidget *widget, GdkEvent *event, gpointer data) +{ + CompEditor *editor = COMP_EDITOR (data); + CompEditorPrivate *priv; + ECalComponentText text; + + priv = editor->priv; + + commit_all_fields (editor); + + if (prompt_to_save_changes (editor, TRUE)) + close_dialog (editor); + + return TRUE; +} + static void attachment_bar_changed_cb (CalAttachmentBar *bar, void *data) @@ -496,6 +515,7 @@ setup_widgets (CompEditor *editor) gtk_dialog_set_response_sensitive (GTK_DIALOG (editor), GTK_RESPONSE_OK, FALSE); g_signal_connect (editor, "response", G_CALLBACK (response_cb), editor); + g_signal_connect (editor, "delete_event", G_CALLBACK (delete_event_cb), editor); /*Attachments */ priv->attachment_scrolled_window = gtk_scrolled_window_new (NULL, NULL); -- cgit v1.2.3