diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 18 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.c | 41 | ||||
-rw-r--r-- | calendar/gui/dialogs/comp-editor.h | 4 | ||||
-rw-r--r-- | calendar/gui/dialogs/event-editor.c | 14 | ||||
-rw-r--r-- | calendar/gui/dialogs/task-editor.c | 14 | ||||
-rw-r--r-- | calendar/gui/itip-utils.c | 11 | ||||
-rw-r--r-- | calendar/gui/itip-utils.h | 4 |
7 files changed, 75 insertions, 31 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 33f2cdff63..4e235e7456 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,23 @@ 2002-09-04 JP Rosevear <jpr@ximian.com> + * gui/dialogs/event-editor.c (event_editor_send_comp): bail out if + we couldn't send the cancel + + * gui/dialogs/task-editor.c (task_editor_send_comp): ditto + + * gui/dialogs/comp-editor.c (save_comp_with_send): indicate send + status + (real_send_comp): return success/fail, only resave the component a + if we successfully sent + (comp_editor_send_comp): return success/fail + + * gui/itip-utils.h: update proto + + * gui/itip-utils.c (itip_send_comp): return true if we sent the + message + +2002-09-04 JP Rosevear <jpr@ximian.com> + * gui/itip-utils.c (comp_server_send): provide error message param, give a dialog with the message if we get a busy result; return TRUE if we succeed diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c index a5ad2b811b..57eee0cef1 100644 --- a/calendar/gui/dialogs/comp-editor.c +++ b/calendar/gui/dialogs/comp-editor.c @@ -91,7 +91,7 @@ static void comp_editor_destroy (GtkObject *object); static void real_set_cal_client (CompEditor *editor, CalClient *client); static void real_edit_comp (CompEditor *editor, CalComponent *comp); -static void real_send_comp (CompEditor *editor, CalComponentItipMethod method); +static gboolean real_send_comp (CompEditor *editor, CalComponentItipMethod method); static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send); static void delete_comp (CompEditor *editor); static void close_dialog (CompEditor *editor); @@ -300,7 +300,6 @@ comp_editor_destroy (GtkObject *object) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } - static gboolean save_comp (CompEditor *editor) { @@ -382,9 +381,9 @@ save_comp_with_send (CompEditor *editor) if (send && send_component_dialog (priv->comp, !priv->existing_org)) { if (itip_organizer_is_user (priv->comp)) - comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); + return comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST); else - comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REPLY); + return comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REPLY); } return TRUE; @@ -950,26 +949,32 @@ real_edit_comp (CompEditor *editor, CalComponent *comp) } -static void +static gboolean real_send_comp (CompEditor *editor, CalComponentItipMethod method) { CompEditorPrivate *priv; CalComponent *tmp_comp; - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); priv = editor->priv; - itip_send_comp (method, priv->comp, priv->client, NULL); + if (itip_send_comp (method, priv->comp, priv->client, NULL)) { + tmp_comp = priv->comp; + gtk_object_ref (GTK_OBJECT (tmp_comp)); + comp_editor_edit_comp (editor, tmp_comp); + gtk_object_unref (GTK_OBJECT (tmp_comp)); + + comp_editor_set_changed (editor, TRUE); + save_comp (editor); - tmp_comp = priv->comp; - gtk_object_ref (GTK_OBJECT (tmp_comp)); - comp_editor_edit_comp (editor, tmp_comp); - gtk_object_unref (GTK_OBJECT (tmp_comp)); + return TRUE; + } comp_editor_set_changed (editor, TRUE); - save_comp (editor); + + return FALSE; } @@ -1061,18 +1066,20 @@ comp_editor_delete_comp (CompEditor *editor) * * **/ -void +gboolean comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) { CompEditorClass *klass; - g_return_if_fail (editor != NULL); - g_return_if_fail (IS_COMP_EDITOR (editor)); + g_return_val_if_fail (editor != NULL, FALSE); + g_return_val_if_fail (IS_COMP_EDITOR (editor), FALSE); klass = COMP_EDITOR_CLASS (GTK_OBJECT (editor)->klass); if (klass->send_comp) - klass->send_comp (editor, method); + return klass->send_comp (editor, method); + + return FALSE; } gboolean diff --git a/calendar/gui/dialogs/comp-editor.h b/calendar/gui/dialogs/comp-editor.h index 18fcd473b7..1f678c1950 100644 --- a/calendar/gui/dialogs/comp-editor.h +++ b/calendar/gui/dialogs/comp-editor.h @@ -55,7 +55,7 @@ typedef struct { /* Virtual functions */ void (* set_cal_client) (CompEditor *page, CalClient *client); void (* edit_comp) (CompEditor *page, CalComponent *comp); - void (* send_comp) (CompEditor *page, CalComponentItipMethod method); + gboolean (* send_comp) (CompEditor *page, CalComponentItipMethod method); } CompEditorClass; GtkType comp_editor_get_type (void); @@ -88,7 +88,7 @@ CalComponent *comp_editor_get_current_comp (CompEditor *editor); gboolean comp_editor_save_comp (CompEditor *editor, gboolean send); void comp_editor_delete_comp (CompEditor *editor); -void comp_editor_send_comp (CompEditor *editor, +gboolean comp_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); gboolean comp_editor_close (CompEditor *editor); void comp_editor_merge_ui (CompEditor *editor, diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c index 7224f6f175..20b91475d4 100644 --- a/calendar/gui/dialogs/event-editor.c +++ b/calendar/gui/dialogs/event-editor.c @@ -57,7 +57,7 @@ static void event_editor_class_init (EventEditorClass *class); static void event_editor_init (EventEditor *ee); static void event_editor_set_cal_client (CompEditor *editor, CalClient *client); static void event_editor_edit_comp (CompEditor *editor, CalComponent *comp); -static void event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); +static gboolean event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); static void event_editor_destroy (GtkObject *object); static void schedule_meeting_cmd (GtkWidget *widget, gpointer data); @@ -320,7 +320,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp) priv->updating = FALSE; } -static void +static gboolean event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) { EventEditor *ee = EVENT_EDITOR (editor); @@ -337,15 +337,21 @@ event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) comp = meeting_page_get_cancel_comp (priv->meet_page); if (comp != NULL) { CalClient *client; + gboolean result; client = e_meeting_model_get_cal_client (priv->model); - itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); + result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); gtk_object_unref (GTK_OBJECT (comp)); + + if (!result) + return FALSE; } parent: if (parent_class->send_comp) - parent_class->send_comp (editor, method); + return parent_class->send_comp (editor, method); + + return FALSE; } /* Destroy handler for the event editor */ diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c index 7a637f34f1..6261b8deda 100644 --- a/calendar/gui/dialogs/task-editor.c +++ b/calendar/gui/dialogs/task-editor.c @@ -51,7 +51,7 @@ struct _TaskEditorPrivate { static void task_editor_class_init (TaskEditorClass *class); static void task_editor_init (TaskEditor *te); static void task_editor_edit_comp (CompEditor *editor, CalComponent *comp); -static void task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); +static gboolean task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method); static void task_editor_destroy (GtkObject *object); static void assign_task_cmd (GtkWidget *widget, gpointer data); @@ -275,7 +275,7 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp) priv->updating = FALSE; } -static void +static gboolean task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) { TaskEditor *te = TASK_EDITOR (editor); @@ -292,15 +292,21 @@ task_editor_send_comp (CompEditor *editor, CalComponentItipMethod method) comp = meeting_page_get_cancel_comp (priv->meet_page); if (comp != NULL) { CalClient *client; + gboolean result; client = e_meeting_model_get_cal_client (priv->model); - itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); + result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL); gtk_object_unref (GTK_OBJECT (comp)); + + if (!result) + return FALSE; } parent: if (parent_class->send_comp) - parent_class->send_comp (editor, method); + return parent_class->send_comp (editor, method); + + return FALSE; } /* Destroy handler for the event editor */ diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c index 544c9f5e25..e388634e93 100644 --- a/calendar/gui/itip-utils.c +++ b/calendar/gui/itip-utils.c @@ -782,7 +782,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp) return clone; } -void +gboolean itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, CalClient *client, icalcomponent *zones) { @@ -799,12 +799,13 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, GNOME_Evolution_Composer_AttachmentData *attach_data = NULL; char *ical_string; CORBA_Environment ev; + gboolean retval = FALSE; CORBA_exception_init (&ev); /* Obtain an object reference for the Composer. */ bonobo_server = bonobo_object_activate (GNOME_EVOLUTION_COMPOSER_OAFIID, 0); - g_return_if_fail (bonobo_server != NULL); + g_return_val_if_fail (bonobo_server != NULL, FALSE); composer_server = BONOBO_OBJREF (bonobo_server); /* Give the server a chance to manipulate the comp */ @@ -858,10 +859,14 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, GNOME_Evolution_Composer_show (composer_server, &ev); if (BONOBO_EX (&ev)) g_warning ("Unable to show the composer while sending iTip message"); + else + retval = TRUE; } else { GNOME_Evolution_Composer_send (composer_server, &ev); if (BONOBO_EX (&ev)) g_warning ("Unable to send iTip message"); + else + retval = TRUE; } cleanup: @@ -891,5 +896,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp, CORBA_free (description); if (attach_data != NULL) CORBA_free (attach_data); + + return retval; } diff --git a/calendar/gui/itip-utils.h b/calendar/gui/itip-utils.h index 6a3e318762..f7a06ac9b0 100644 --- a/calendar/gui/itip-utils.h +++ b/calendar/gui/itip-utils.h @@ -37,8 +37,8 @@ gboolean itip_sentby_is_user (CalComponent *comp); const gchar *itip_strip_mailto (const gchar *address); -void itip_send_comp (CalComponentItipMethod method, CalComponent *comp, - CalClient *client, icalcomponent *zones); +gboolean itip_send_comp (CalComponentItipMethod method, CalComponent *comp, + CalClient *client, icalcomponent *zones); #endif |