diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 10 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 32 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 3 |
3 files changed, 37 insertions, 8 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 9adc332c60..17074e8c0c 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,15 @@ 2007-11-05 Milan Crha <mcrha@redhat.com> + ** 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. + +2007-11-05 Milan Crha <mcrha@redhat.com> + ** Fix for bug #341085 * gui/e-day-view.c: (e_day_view_reshape_day_event): 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; } diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index aac50e9d87..e761061939 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -100,7 +100,8 @@ ECal *comp_editor_get_e_cal (CompEditor *editor); void comp_editor_edit_comp (CompEditor *ee, ECalComponent *comp); ECalComponent *comp_editor_get_comp (CompEditor *editor); -ECalComponent *comp_editor_get_current_comp (CompEditor *editor); +ECalComponent *comp_editor_get_current_comp (CompEditor *editor, + gboolean *correct); gboolean comp_editor_save_comp (CompEditor *editor, gboolean send); void comp_editor_delete_comp (CompEditor *editor); |