From dc84df9871b3171a21d62feec988160f3c608103 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Thu, 7 Aug 2003 16:38:20 +0000 Subject: Merge new-calendar-branch into HEAD svn path=/trunk/; revision=22129 --- calendar/gui/e-itip-control.c | 79 +++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 32 deletions(-) (limited to 'calendar/gui/e-itip-control.c') diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c index 2e1ff4cb67..91a355f269 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -304,13 +304,13 @@ find_server (GPtrArray *servers, CalComponent *comp) cal_component_get_uid (comp, &uid); for (i = 0; i < servers->len; i++) { CalClient *client; - CalComponent *found_comp; + icalcomponent *icalcomp; CalClientGetStatus status; client = g_ptr_array_index (servers, i); - status = cal_client_get_object (client, uid, &found_comp); + status = cal_client_get_object (client, uid, &icalcomp); if (status == CAL_CLIENT_GET_SUCCESS) { - g_object_unref (found_comp); + icalcomponent_free (icalcomp); g_object_ref (client); return client; @@ -1248,6 +1248,7 @@ get_real_item (EItipControl *itip) { EItipControlPrivate *priv; CalComponent *comp; + icalcomponent *icalcomp; CalComponentVType type; CalClientGetStatus status = CAL_CLIENT_GET_NOT_FOUND; const char *uid; @@ -1260,11 +1261,11 @@ get_real_item (EItipControl *itip) switch (type) { case CAL_COMPONENT_EVENT: if (priv->event_client != NULL) - status = cal_client_get_object (priv->event_client, uid, &comp); + status = cal_client_get_object (priv->event_client, uid, &icalcomp); break; case CAL_COMPONENT_TODO: if (priv->task_client != NULL) - status = cal_client_get_object (priv->task_client, uid, &comp); + status = cal_client_get_object (priv->task_client, uid, &icalcomp); break; default: status = CAL_CLIENT_GET_NOT_FOUND; @@ -1273,6 +1274,13 @@ get_real_item (EItipControl *itip) if (status != CAL_CLIENT_GET_SUCCESS) return NULL; + comp = cal_component_new (); + if (!cal_component_set_icalcomponent (comp, icalcomp)) { + g_object_unref (comp); + icalcomponent_free (icalcomp); + return NULL; + } + return comp; } @@ -1936,6 +1944,7 @@ update_attendee_status (EItipControl *itip) CalClient *client; CalClientGetStatus status; CalComponent *comp = NULL; + icalcomponent *icalcomp = NULL; CalComponentVType type; const char *uid; GtkWidget *dialog; @@ -1957,41 +1966,47 @@ update_attendee_status (EItipControl *itip) /* Obtain our version */ cal_component_get_uid (priv->comp, &uid); - status = cal_client_get_object (client, uid, &comp); + status = cal_client_get_object (client, uid, &icalcomp); if (status == CAL_CLIENT_GET_SUCCESS) { GSList *attendees; - cal_component_get_attendee_list (priv->comp, &attendees); - if (attendees != NULL) { - CalComponentAttendee *a = attendees->data; - icalproperty *prop; + comp = cal_component_new (); + if (!cal_component_set_icalcomponent (comp, icalcomp)) { + icalcomponent_free (icalcomp); - prop = find_attendee (cal_component_get_icalcomponent (comp), - itip_strip_mailto (a->value)); - - if (prop == NULL) { - dialog = gnome_question_dialog_modal (_("This response is not from a current " - "attendee. Add as an attendee?"), - NULL, NULL); - if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == GNOME_YES) { - change_status (cal_component_get_icalcomponent (comp), + dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n")); + } else { + cal_component_get_attendee_list (priv->comp, &attendees); + if (attendees != NULL) { + CalComponentAttendee *a = attendees->data; + icalproperty *prop; + + prop = find_attendee (icalcomp, itip_strip_mailto (a->value)); + + if (prop == NULL) { + dialog = gnome_question_dialog_modal (_("This response is not from a current " + "attendee. Add as an attendee?"), + NULL, NULL); + if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == GNOME_YES) { + change_status (icalcomp, + itip_strip_mailto (a->value), + a->status); + cal_component_rescan (comp); + } else { + goto cleanup; + } + } else if (a->status == ICAL_PARTSTAT_NONE || a->status == ICAL_PARTSTAT_X) { + dialog = gnome_warning_dialog (_("Attendee status could " + "not be updated because " + "of an invalid status!\n")); + goto cleanup; + } else { + change_status (icalcomp, itip_strip_mailto (a->value), a->status); - cal_component_rescan (comp); - } else { - goto cleanup; + cal_component_rescan (comp); } - } else if (a->status == ICAL_PARTSTAT_NONE || a->status == ICAL_PARTSTAT_X) { - dialog = gnome_warning_dialog (_("Attendee status could " - "not be updated because " - "of an invalid status!\n")); - goto cleanup; - } else { - change_status (cal_component_get_icalcomponent (comp), - itip_strip_mailto (a->value), - a->status); - cal_component_rescan (comp); } } -- cgit v1.2.3