From f679ec6e047ae7fad54444965827497a33118624 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Fri, 7 Jan 2005 17:38:49 +0000 Subject: protos 2005-01-07 JP Rosevear * itip-view.h: protos * itip-view.c (rsvp_toggled_cb): set comment sensitivity (itip_view_init): add comment entry (itip_view_set_rsvp): make comment entry sensitive when rsvp is (itip_view_set_rsvp_comment): accessor (itip_view_get_rsvp_comment): ditto * itip-formatter.c (find_cal_opened_cb): set error message if we can't find the item (view_response_cb): add comment if the user sets one svn path=/trunk/; revision=28275 --- plugins/itip-formatter/itip-formatter.c | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) (limited to 'plugins/itip-formatter/itip-formatter.c') diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 9a4d5d49cb..8e22e7d239 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -407,6 +407,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) itip_view_clear_lower_info_items (ITIP_VIEW (pitip->view)); pitip->progress_info_id = 0; + /* FIXME Check read only state of calendar? */ itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Found the appointment in the calendar '%s'", e_source_peek_name (source)); @@ -418,6 +419,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) cleanup: if (fd->count == 0) { + itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id); + pitip->progress_info_id = 0; + if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) && !pitip->current_ecal) { ESource *source = NULL; @@ -451,9 +455,6 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) /* FIXME Default to the suggestion for RSVP for my attendee */ itip_view_set_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE); itip_view_set_show_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE); - - itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id); - pitip->progress_info_id = 0; if (source) { itip_view_set_source (ITIP_VIEW (pitip->view), source); @@ -463,8 +464,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to find any calendars"); itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); } - } else { - /* FIXME Display error message to user */ + } else if (!pitip->current_ecal) { + itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, + "Unable to find this meeting in any calendar"); } g_free (fd->uid); @@ -923,7 +925,7 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) icalcomponent *ical_comp; icalproperty *prop; icalvalue *value; - const char *attendee; + const char *attendee, *comment; GSList *l, *list = NULL; comp = e_cal_component_clone (pitip->comp); @@ -937,7 +939,8 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) g_assert (pitip->my_address != NULL); ical_comp = e_cal_component_get_icalcomponent (comp); - + + /* Remove all attendees except the one we are responding as */ for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); prop != NULL; prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) @@ -964,6 +967,21 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) } g_slist_free (list); + /* Add a comment if there user set one */ + comment = itip_view_get_rsvp_comment (ITIP_VIEW (pitip->view)); + if (comment) { + GSList comments; + ECalComponentText text; + + text.value = comment; + text.altrep = NULL; + + comments.data = &text; + comments.next = NULL; + + e_cal_component_set_comment_list (comp, &comments); + } + e_cal_component_rescan (comp); itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level); -- cgit