From c2f127554d35c922c4035576e48bab1c1759f689 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 5 Nov 2007 12:18:36 +0000 Subject: ** Fix for bug #353780 2007-11-05 Milan Crha ** Fix for bug #353780 * gui/dialogs/comp-editor.h: (comp_editor_get_current_comp): * gui/dialogs/comp-editor.c: (prompt_and_save_changes), (menu_file_save_cb), (comp_editor_append_page), (comp_editor_get_current_comp): Stop processing immediately when page is filled incorrectly. svn path=/trunk/; revision=34509 --- calendar/gui/dialogs/comp-editor.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'calendar/gui/dialogs/comp-editor.c') diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index 030d07b111..e2ca1b5730 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -902,7 +902,7 @@ static gboolean prompt_and_save_changes (CompEditor *editor, gboolean send) { CompEditorPrivate *priv; - gboolean read_only; + gboolean read_only, correct = FALSE; ECalComponent *comp; ECalComponentText text; @@ -919,10 +919,13 @@ prompt_and_save_changes (CompEditor *editor, gboolean send) return FALSE; } - comp = comp_editor_get_current_comp (editor); + comp = comp_editor_get_current_comp (editor, &correct); e_cal_component_get_summary (comp, &text); g_object_unref (comp); + if (!correct) + return FALSE; + if (!text.value) if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) return FALSE; @@ -1261,7 +1264,7 @@ menu_file_save_cb (BonoboUIComponent *uic, CompEditorPrivate *priv = editor->priv; ECalComponentText text; gboolean delegated = FALSE; - gboolean read_only; + gboolean read_only, correct = FALSE; ECalComponent *comp; if (e_attachment_bar_get_download_count (E_ATTACHMENT_BAR (editor->priv->attachment_bar)) ){ @@ -1295,10 +1298,13 @@ menu_file_save_cb (BonoboUIComponent *uic, if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor), delegated)) return; - comp = comp_editor_get_current_comp (editor); + comp = comp_editor_get_current_comp (editor, &correct); e_cal_component_get_summary (comp, &text); g_object_unref (comp); + if (!correct) + return; + if (!text.value) if (!send_component_prompt_subject ((GtkWindow *) editor, priv->client, priv->comp)) return; @@ -2009,7 +2015,7 @@ comp_editor_append_page (CompEditor *editor, if (priv->comp != NULL) { ECalComponent *comp; - comp = comp_editor_get_current_comp (editor); + comp = comp_editor_get_current_comp (editor, NULL); comp_editor_page_fill_widgets (page, comp); g_object_unref (comp); } @@ -2681,12 +2687,21 @@ comp_editor_get_comp (CompEditor *editor) return priv->comp; } +/** + * comp_editor_get_current_comp + * + * @param editor + * @param correct Set this no non-NULL if you are interested to know if + * all pages reported success when filling component. + * @return Newly allocated component, should be unref-ed by g_object_unref. + **/ ECalComponent * -comp_editor_get_current_comp (CompEditor *editor) +comp_editor_get_current_comp (CompEditor *editor, gboolean *correct) { CompEditorPrivate *priv; ECalComponent *comp; GList *l; + gboolean all_ok = TRUE; g_return_val_if_fail (editor != NULL, NULL); g_return_val_if_fail (IS_COMP_EDITOR (editor), NULL); @@ -2696,9 +2711,12 @@ comp_editor_get_current_comp (CompEditor *editor) comp = e_cal_component_clone (priv->comp); if (priv->changed) { for (l = priv->pages; l != NULL; l = l->next) - comp_editor_page_fill_component (l->data, comp); + all_ok = comp_editor_page_fill_component (l->data, comp) && all_ok; } + if (correct) + *correct = all_ok; + return comp; } -- cgit v1.2.3