From 95e875ecf4b48f84fe6b9dd475669396a9609e20 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Mon, 17 Dec 2001 20:07:22 +0000 Subject: use get_real_item (get_refresh_options): uncomment out (get_real_item): 2001-12-17 JP Rosevear * gui/e-itip-control.c (send_item): use get_real_item (get_refresh_options): uncomment out (get_real_item): obtain the real object which has the uid of the item received (show_current_todo): use get_refresh_options for refresh method and provide the description and summary from the real component since its not in the reply (show_current_event): ditto (send_item): use get_real_item 2001-12-17 JP Rosevear * gui/itip-utils.c (comp_limit_attendees): can't remove properties in an iteration loop, so remove them outside the loop (comp_minimal): don't set a recurid if there isn't one, add the x properties to the clone (comp_compliant): unref the clone for DECLINECOUNTER * gui/e-itip-control.c (get_refresh_options): make function available again (show_current_event): use it here (ok_clicked_cb): can't remove properties in an iteration loop, so remove them outside the loop * cal-util/cal-component.c (free_icalcomponent): properly free the attendee list (cal_component_rescan): don't destroy the alarm hash svn path=/trunk/; revision=15136 --- calendar/gui/e-itip-control.c | 120 ++++++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 28 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 d34f609094..18991630a0 100644 --- a/calendar/gui/e-itip-control.c +++ b/calendar/gui/e-itip-control.c @@ -833,7 +833,6 @@ get_reply_options () U_("OK")); } -#if 0 static char* get_refresh_options () { @@ -846,7 +845,6 @@ get_refresh_options () U_("Send Latest Information"), U_("OK")); } -#endif static char* get_cancel_options () @@ -861,10 +859,43 @@ get_cancel_options () U_("OK")); } + +static CalComponent * +get_real_item (EItipControl *itip) +{ + EItipControlPrivate *priv; + CalComponent *comp; + CalComponentVType type; + CalClientGetStatus status; + const char *uid; + + priv = itip->priv; + + type = cal_component_get_vtype (priv->comp); + cal_component_get_uid (priv->comp, &uid); + + switch (type) { + case CAL_COMPONENT_EVENT: + status = cal_client_get_object (priv->event_client, uid, &comp); + break; + case CAL_COMPONENT_TODO: + status = cal_client_get_object (priv->task_client, uid, &comp); + break; + default: + status = CAL_CLIENT_GET_NOT_FOUND; + } + + if (status != CAL_CLIENT_GET_SUCCESS) + return NULL; + + return comp; +} + static void show_current_event (EItipControl *itip) { EItipControlPrivate *priv; + CalComponent *comp; const gchar *itip_title, *itip_desc; char *options; @@ -889,7 +920,26 @@ show_current_event (EItipControl *itip) case ICAL_METHOD_REFRESH: itip_desc = U_("%s wishes to receive the latest meeting information."); itip_title = U_("Meeting Update Request"); - options = get_publish_options (); + options = get_refresh_options (); + + /* Provide extra info, since its not in the component */ + comp = get_real_item (itip); + if (comp != NULL) { + CalComponentText text; + GSList *l; + + cal_component_get_summary (comp, &text); + cal_component_set_summary (priv->comp, &text); + cal_component_get_description_list (comp, &l); + cal_component_set_description_list (priv->comp, l); + cal_component_free_text_list (l); + + gtk_object_unref (GTK_OBJECT (comp)); + } else { + CalComponentText text = {_("Unknown"), NULL}; + + cal_component_set_summary (priv->comp, &text); + } break; case ICAL_METHOD_REPLY: itip_desc = U_("%s has replied to a meeting request."); @@ -915,6 +965,7 @@ static void show_current_todo (EItipControl *itip) { EItipControlPrivate *priv; + CalComponent *comp; const gchar *itip_title, *itip_desc; char *options; @@ -939,7 +990,27 @@ show_current_todo (EItipControl *itip) case ICAL_METHOD_REFRESH: itip_desc = U_("%s wishes to receive the latest task information."); itip_title = U_("Task Update Request"); - options = get_publish_options (); + options = get_refresh_options (); + + + /* Provide extra info, since its not in the component */ + comp = get_real_item (itip); + if (comp != NULL) { + CalComponentText text; + GSList *l; + + cal_component_get_summary (comp, &text); + cal_component_set_summary (priv->comp, &text); + cal_component_get_description_list (comp, &l); + cal_component_set_description_list (priv->comp, l); + cal_component_free_text_list (l); + + gtk_object_unref (GTK_OBJECT (comp)); + } else { + CalComponentText text = {_("Unknown"), NULL}; + + cal_component_set_summary (priv->comp, &text); + } break; case ICAL_METHOD_REPLY: itip_desc = U_("%s has replied to a task assignment."); @@ -1335,29 +1406,15 @@ send_item (EItipControl *itip) { EItipControlPrivate *priv; CalComponent *comp; - CalComponentVType type; - const char *uid; - CalClientGetStatus status; GtkWidget *dialog; priv = itip->priv; - type = cal_component_get_vtype (priv->comp); - cal_component_get_uid (priv->comp, &uid); + comp = get_real_item (itip); - switch (type) { - case CAL_COMPONENT_EVENT: - status = cal_client_get_object (priv->event_client, uid, &comp); - break; - case CAL_COMPONENT_TODO: - status = cal_client_get_object (priv->task_client, uid, &comp); - break; - default: - status = CAL_CLIENT_GET_NOT_FOUND; - } - - if (status == CAL_CLIENT_GET_SUCCESS) { - itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp); + if (comp != NULL) { + itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp); + gtk_object_unref (GTK_OBJECT (comp)); dialog = gnome_ok_dialog (_("Item sent!\n")); } else { dialog = gnome_warning_dialog (_("The item could not be sent!\n")); @@ -1552,9 +1609,10 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar if (priv->my_address != NULL) { icalcomponent *ical_comp; icalproperty *prop; - const char *attendee, *text; icalvalue *value; - + const char *attendee, *text; + GSList *l, *list = NULL; + ical_comp = cal_component_get_icalcomponent (comp); for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); @@ -1568,11 +1626,17 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar attendee = icalvalue_get_string (value); text = itip_strip_mailto (attendee); - if (!strstr (text, priv->my_address)) { - icalcomponent_remove_property (ical_comp, prop); - icalproperty_free (prop); - } + if (!strstr (text, priv->my_address)) + list = g_slist_prepend (list, prop); } + + for (l = list; l; l = l->next) { + prop = l->data; + icalcomponent_remove_property (ical_comp, prop); + icalproperty_free (prop); + } + g_slist_free (list); + cal_component_rescan (comp); itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp); } else { -- cgit v1.2.3