From ec730bb5f70e7600085befbd3bf9cc334187973e Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Wed, 8 Aug 2001 22:16:08 +0000 Subject: set the attendees of a component (meeting_page_fill_component): use above 2001-08-08 JP Rosevear * gui/dialogs/meeting-page.c (set_attendees): set the attendees of a component (meeting_page_fill_component): use above (meeting_page_get_cancel_comp): return a comp with the attendees to be cancelled * gui/dialogs/meeting-page.h: get a component that will be sent as a cancellation * gui/dialogs/event-editor.c (event_editor_class_init): override send_comp class method (event_editor_send_comp): send cancellation notices to deleted attendees (refresh_meeting_cmd): save before send (forward_cmd): ditto * gui/dialogs/comp-editor.c (comp_editor_class_init): set default send_comp method (real_send_comp): do the real work (comp_editor_send_comp): call class method (save_comp): don't do any sending (save_comp_with_send): save and send here (prompt_to_save_changes): use above (save_close_cmd): ditto * gui/dialogs/comp-editor.h: add virtual function svn path=/trunk/; revision=11803 --- calendar/gui/dialogs/comp-editor.c | 55 ++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 14 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 6023e80295..ba0ed77ec6 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -77,7 +77,9 @@ static void comp_editor_init (CompEditor *editor); static void comp_editor_destroy (GtkObject *object); static void real_edit_comp (CompEditor *editor, CalComponent *comp); +static void real_send_comp (CompEditor *editor, CalComponentItipMethod method); static void save_comp (CompEditor *editor); +static void save_comp_with_send (CompEditor *editor); static void delete_comp (CompEditor *editor); static void close_dialog (CompEditor *editor); @@ -163,6 +165,7 @@ comp_editor_class_init (CompEditorClass *klass) parent_class = gtk_type_class (GTK_TYPE_OBJECT); klass->edit_comp = real_edit_comp; + klass->send_comp = real_send_comp; object_class->destroy = comp_editor_destroy; } @@ -523,6 +526,20 @@ real_edit_comp (CompEditor *editor, CalComponent *comp) fill_widgets (editor); } + +static void +real_send_comp (CompEditor *editor, CalComponentItipMethod method) +{ + CompEditorPrivate *priv; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); + + priv = editor->priv; + + itip_send_comp (method, priv->comp); +} + /** * comp_editor_edit_comp: @@ -600,14 +617,15 @@ comp_editor_delete_comp (CompEditor *editor) void comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) { - CalComponent *comp; - - comp = comp_editor_get_current_comp (editor); - - cal_component_commit_sequence (comp); - itip_send_comp (method, comp); + CompEditorClass *klass; + + g_return_if_fail (editor != NULL); + g_return_if_fail (IS_COMP_EDITOR (editor)); - gtk_object_unref (GTK_OBJECT (comp)); + klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); + + if (klass->send_comp) + klass->send_comp (editor, method); } /** @@ -704,11 +722,7 @@ save_comp (CompEditor *editor) for (l = priv->pages; l != NULL; l = l->next) comp_editor_page_fill_component (l->data, priv->comp); - - if (priv->needs_send && send_component_dialog (priv->comp)) { - cal_component_commit_sequence (priv->comp); - itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, priv->comp); - } + cal_component_commit_sequence (priv->comp); priv->updating = TRUE; @@ -720,6 +734,19 @@ save_comp (CompEditor *editor) priv->updating = FALSE; } +static void +save_comp_with_send (CompEditor *editor) +{ + CompEditorPrivate *priv; + + priv = editor->priv; + + save_comp (editor); + + if (priv->needs_send && send_component_dialog (priv->comp)) + comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); +} + static void delete_comp (CompEditor *editor) { @@ -749,7 +776,7 @@ prompt_to_save_changes (CompEditor *editor) case 0: /* Save */ /* FIXME: If an error occurs here, we should popup a dialog and then return FALSE. */ - save_comp (editor); + save_comp_with_send (editor); return TRUE; case 1: /* Discard */ return TRUE; @@ -782,7 +809,7 @@ save_close_cmd (GtkWidget *widget, gpointer data) { CompEditor *editor = COMP_EDITOR (data); - save_comp (editor); + save_comp_with_send (editor); close_dialog (editor); } -- cgit v1.2.3