diff options
author | JP Rosevear <jpr@novell.com> | 2005-01-07 23:58:17 +0800 |
---|---|---|
committer | JP Rosevear <jpr@src.gnome.org> | 2005-01-07 23:58:17 +0800 |
commit | 30ef2f04dbb8180543fd98670517a3851940960a (patch) | |
tree | 0382a138df0b4bdbd7afa5f17e1b340c30cc545c /plugins/itip-formatter | |
parent | 3189458511655d73566b9eaf698dbbae8be02f2a (diff) | |
download | gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar.gz gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar.bz2 gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar.lz gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar.xz gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.tar.zst gsoc2013-evolution-30ef2f04dbb8180543fd98670517a3851940960a.zip |
add protos
2005-01-07 JP Rosevear <jpr@novell.com>
* itip-view.h: add protos
* itip-view.c (set_sender_text): update descriptions better
(set_status_text): show/hide status
(set_comment_text): show/hide comment
(set_buttons): update buttons for add an refresh
(itip_view_destroy): free comment/status
(itip_view_init): add status/comment widgets
(itip_view_set_status): accessor
(itip_view_get_status): ditto
(itip_view_set_comment): ditto
(itip_view_get_comment): ditto
* itip-formatter.c (find_cal_opened_cb): make sure rsvp is off for
publish
(format_itip_object): decline counter is sent by an organizer; set
status and comment when appropriate
svn path=/trunk/; revision=28270
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r-- | plugins/itip-formatter/ChangeLog | 20 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-formatter.c | 52 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-view.c | 148 | ||||
-rw-r--r-- | plugins/itip-formatter/itip-view.h | 6 |
4 files changed, 205 insertions, 21 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index 89e8c98d8e..974fdaabac 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,23 @@ +2005-01-07 JP Rosevear <jpr@novell.com> + + * itip-view.h: add protos + + * itip-view.c (set_sender_text): update descriptions better + (set_status_text): show/hide status + (set_comment_text): show/hide comment + (set_buttons): update buttons for add an refresh + (itip_view_destroy): free comment/status + (itip_view_init): add status/comment widgets + (itip_view_set_status): accessor + (itip_view_get_status): ditto + (itip_view_set_comment): ditto + (itip_view_get_comment): ditto + + * itip-formatter.c (find_cal_opened_cb): make sure rsvp is off for + publish + (format_itip_object): decline counter is sent by an organizer; set + status and comment when appropriate + 2005-01-05 Rodney Dawes <dobey@novell.com> * Makefile.am: Dist the errors data properly, and add the .eplug diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index bcd0a1d2c8..9a4d5d49cb 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -397,6 +397,7 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) /* Provide extra info, since its not in the component */ /* FIXME Check sequence number of meeting? */ /* FIXME Do we need to adjust elsewhere for the delegated calendar item? */ + /* FIXME Need to update the fields in the view now */ if (pitip->method == ICAL_METHOD_REPLY || pitip->method == ICAL_METHOD_REFRESH) adjust_item (pitip, pitip->comp); @@ -448,8 +449,8 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) /* The only method that RSVP makes sense for is REQUEST */ /* FIXME Default to the suggestion for RSVP for my attendee */ - itip_view_set_rsvp (ITIP_VIEW (pitip->view), TRUE); - itip_view_set_show_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE ); + 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; @@ -1039,6 +1040,7 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject case ICAL_METHOD_REQUEST: case ICAL_METHOD_ADD: case ICAL_METHOD_CANCEL: + case ICAL_METHOD_DECLINECOUNTER: /* An organizer sent this */ e_cal_component_get_organizer (pitip->comp, &organizer); itip_view_set_organizer (ITIP_VIEW (pitip->view), organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value)); @@ -1054,7 +1056,6 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject case ICAL_METHOD_REPLY: case ICAL_METHOD_REFRESH: case ICAL_METHOD_COUNTER: - case ICAL_METHOD_DECLINECOUNTER: /* An attendee sent this */ e_cal_component_get_attendee_list (pitip->comp, &list); if (list != NULL) { @@ -1066,11 +1067,11 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject e_cal_component_free_attendee_list (list); } - break; default: /* FIXME What to do here? */ itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_ERROR); + break; } e_cal_component_get_summary (pitip->comp, &text); @@ -1079,16 +1080,51 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject e_cal_component_get_location (pitip->comp, &string); itip_view_set_location (ITIP_VIEW (pitip->view), string); - e_cal_component_get_location (pitip->comp, &string); - itip_view_set_location (ITIP_VIEW (pitip->view), string); + /* Status really only applies for REPLY */ + if (pitip->method == ICAL_METHOD_REPLY) { + e_cal_component_get_attendee_list (pitip->comp, &list); + if (list != NULL) { + ECalComponentAttendee *a = list->data; + + switch (a->status) { + case ICAL_PARTSTAT_ACCEPTED: + itip_view_set_status (ITIP_VIEW (pitip->view), _("Accepted")); + break; + case ICAL_PARTSTAT_TENTATIVE: + itip_view_set_status (ITIP_VIEW (pitip->view), _("Tentatively Accepted")); + break; + case ICAL_PARTSTAT_DECLINED: + itip_view_set_status (ITIP_VIEW (pitip->view), _("Declined")); + break; + default: + itip_view_set_status (ITIP_VIEW (pitip->view), _("Unknown")); + } + } + e_cal_component_free_attendee_list (list); + } + if (pitip->method == ICAL_METHOD_REPLY + || pitip->method == ICAL_METHOD_COUNTER + || pitip->method == ICAL_METHOD_DECLINECOUNTER) { + /* FIXME Check spec to see if multiple comments are actually valid */ + /* Comments for ITIP are limited to one per object */ + e_cal_component_get_comment_list (pitip->comp, &list); + if (list) { + ECalComponentText *text = list->data; + + if (text->value) + itip_view_set_comment (ITIP_VIEW (pitip->view), text->value); + } + e_cal_component_free_text_list (list); + } + e_cal_component_get_description_list (pitip->comp, &list); for (l = list; l; l = l->next) { ECalComponentText *text = l->data; - if (!gstring) + if (!gstring && text->value) gstring = g_string_new (text->value); - else + else if (text->value) g_string_append_printf (gstring, "\n\n%s", text->value); } e_cal_component_free_text_list (list); diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index a8a8a1e979..0c76fc316a 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -73,6 +73,14 @@ struct _ItipViewPrivate { GtkWidget *location_label; char *location; + GtkWidget *status_header; + GtkWidget *status_label; + char *status; + + GtkWidget *comment_header; + GtkWidget *comment_label; + char *comment; + GtkWidget *start_header; GtkWidget *start_label; struct tm *start_tm; @@ -303,19 +311,22 @@ set_sender_text (ItipView *view) sender = g_strdup_printf (_("<b>%s</b> wishes to receive the latest information for the following meeting:"), attendee); break; case ITIP_VIEW_MODE_REPLY: - sender = g_strdup_printf (_("<b>%s</b> has accepted the following meeting:"), attendee); + sender = g_strdup_printf (_("<b>%s</b> has sent back the following meeting response:"), attendee); break; case ITIP_VIEW_MODE_CANCEL: if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the follow meeting:"), organizer, priv->sentby); + sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the following meeting:"), organizer, priv->sentby); else sender = g_strdup_printf (_("<b>%s</b> has cancelled the following meeting."), organizer); break; case ITIP_VIEW_MODE_COUNTER: + sender = g_strdup_printf (_("<b>%s</b> has proposed the following meeting changes."), attendee); + break; + case ITIP_VIEW_MODE_DECLINECOUNTER: if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the follow meeting:"), organizer, priv->sentby); + sender = g_strdup_printf (_("<b>%s</b> through %s has declined the following meeting changes:"), organizer, priv->sentby); else - sender = g_strdup_printf (_("<b>%s</b> has cancelled the following meeting."), organizer); + sender = g_strdup_printf (_("<b>%s</b> has declined the following meeting changes."), organizer); break; default: break; @@ -357,6 +368,32 @@ set_location_text (ItipView *view) } static void +set_status_text (ItipView *view) +{ + ItipViewPrivate *priv; + + priv = view->priv; + + gtk_label_set_text (GTK_LABEL (priv->status_label), priv->status); + + priv->status ? gtk_widget_show (priv->status_header) : gtk_widget_hide (priv->status_header); + priv->status ? gtk_widget_show (priv->status_label) : gtk_widget_hide (priv->status_label); +} + +static void +set_comment_text (ItipView *view) +{ + ItipViewPrivate *priv; + + priv = view->priv; + + gtk_label_set_text (GTK_LABEL (priv->comment_label), priv->comment); + + priv->comment ? gtk_widget_show (priv->comment_header) : gtk_widget_hide (priv->comment_header); + priv->comment ? gtk_widget_show (priv->comment_label) : gtk_widget_hide (priv->comment_label); +} + +static void set_description_text (ItipView *view) { ItipViewPrivate *priv; @@ -533,12 +570,13 @@ set_buttons (ItipView *view) set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); break; case ITIP_VIEW_MODE_ADD: - /* FIXME Right response? */ - set_one_button (view, "_Add", GTK_STOCK_ADD, ITIP_VIEW_RESPONSE_UPDATE); + set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE); + set_one_button (view, "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE); + set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); break; case ITIP_VIEW_MODE_REFRESH: /* FIXME Is this really the right button? */ - set_one_button (view, "_Send Meeting Information", GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_REFRESH); + set_one_button (view, "_Send Information", GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_REFRESH); break; case ITIP_VIEW_MODE_REPLY: /* FIXME Is this really the right button? */ @@ -574,6 +612,8 @@ itip_view_destroy (GtkObject *object) g_free (priv->delegator); g_free (priv->attendee); g_free (priv->location); + g_free (priv->status); + g_free (priv->comment); g_free (priv->start_tm); g_free (priv->end_tm); @@ -621,14 +661,14 @@ static void itip_view_init (ItipView *view) { ItipViewPrivate *priv; - GtkWidget *icon, *vbox, *separator, *table; + GtkWidget *icon, *vbox, *details_vbox, *separator, *table; priv = g_new0 (ItipViewPrivate, 1); view->priv = priv; priv->mode = ITIP_VIEW_MODE_NONE; - /* The icon on the LHS */ + /* The meeting icon */ icon = e_icon_factory_get_image (MEETING_ICON, E_ICON_SIZE_LARGE_TOOLBAR); gtk_misc_set_alignment (GTK_MISC (icon), 0, 0); gtk_widget_show (icon); @@ -652,7 +692,7 @@ itip_view_init (ItipView *view) gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 6); /* A table with information on the meeting and any extra info/warnings */ - table = gtk_table_new (3, 2, FALSE); + table = gtk_table_new (6, 2, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 6); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_widget_show (table); @@ -689,6 +729,22 @@ itip_view_init (ItipView *view) gtk_table_attach (GTK_TABLE (table), priv->end_header, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); gtk_table_attach (GTK_TABLE (table), priv->end_label, 1, 2, 3, 4, GTK_FILL, 0, 0, 0); + /* Status */ + priv->status_header = gtk_label_new (_("Status:")); + priv->status_label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (priv->status_header), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (priv->status_label), 0, 0.5); + gtk_table_attach (GTK_TABLE (table), priv->status_header, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (table), priv->status_label, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); + + /* Comment */ + priv->comment_header = gtk_label_new (_("Comment:")); + priv->comment_label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (priv->comment_header), 0, 0.5); + gtk_misc_set_alignment (GTK_MISC (priv->comment_label), 0, 0.5); + gtk_table_attach (GTK_TABLE (table), priv->comment_header, 0, 1, 5, 6, GTK_FILL, 0, 0, 0); + gtk_table_attach (GTK_TABLE (table), priv->comment_label, 1, 2, 5, 6, GTK_FILL, 0, 0, 0); + /* Upper Info items */ priv->upper_info_box = gtk_vbox_new (FALSE, 0); gtk_widget_show (priv->upper_info_box); @@ -710,12 +766,16 @@ itip_view_init (ItipView *view) gtk_box_pack_start (GTK_BOX (vbox), priv->lower_info_box, FALSE, FALSE, 6); /* Detail area */ + details_vbox = gtk_vbox_new (FALSE, 0); + gtk_widget_show (details_vbox); + gtk_box_pack_start (GTK_BOX (vbox), details_vbox, FALSE, FALSE, 0); + priv->details_box = gtk_hbox_new (FALSE, 0); gtk_widget_show (priv->details_box); - gtk_box_pack_start (GTK_BOX (vbox), priv->details_box, FALSE, FALSE, 6); + gtk_box_pack_start (GTK_BOX (details_vbox), priv->details_box, FALSE, FALSE, 0); priv->rsvp_check = gtk_check_button_new_with_mnemonic ("Send _reply to sender"); - gtk_box_pack_end (GTK_BOX (priv->details_box), priv->rsvp_check, FALSE, FALSE, 6); + gtk_box_pack_end (GTK_BOX (details_vbox), priv->rsvp_check, FALSE, FALSE, 6); /* The buttons for actions */ priv->button_box = gtk_hbutton_box_new (); @@ -919,7 +979,69 @@ itip_view_get_location (ItipView *view) return priv->location; } -/* FIXME Status and description */ +void +itip_view_set_status (ItipView *view, const char *status) +{ + ItipViewPrivate *priv; + + g_return_if_fail (view != NULL); + g_return_if_fail (ITIP_IS_VIEW (view)); + + priv = view->priv; + + if (priv->status) + g_free (priv->status); + + priv->status = status ? g_strstrip (g_strdup (status)) : NULL; + + set_status_text (view); +} + +const char * +itip_view_get_status (ItipView *view) +{ + ItipViewPrivate *priv; + + g_return_val_if_fail (view != NULL, NULL); + g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); + + priv = view->priv; + + return priv->status; +} + +void +itip_view_set_comment (ItipView *view, const char *comment) +{ + ItipViewPrivate *priv; + + g_return_if_fail (view != NULL); + g_return_if_fail (ITIP_IS_VIEW (view)); + + priv = view->priv; + + if (priv->comment) + g_free (priv->comment); + + priv->comment = comment ? g_strstrip (g_strdup (comment)) : NULL; + + set_comment_text (view); +} + +const char * +itip_view_get_comment (ItipView *view) +{ + ItipViewPrivate *priv; + + g_return_val_if_fail (view != NULL, NULL); + g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); + + priv = view->priv; + + return priv->comment; +} + + void itip_view_set_description (ItipView *view, const char *description) { diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h index d71f0796eb..f786ad330f 100644 --- a/plugins/itip-formatter/itip-view.h +++ b/plugins/itip-formatter/itip-view.h @@ -111,6 +111,12 @@ const char *itip_view_get_summary (ItipView *view); void itip_view_set_location (ItipView *view, const char *location); const char *itip_view_get_location (ItipView *view); +void itip_view_set_status (ItipView *view, const char *status); +const char *itip_view_get_status (ItipView *view); + +void itip_view_set_comment (ItipView *view, const char *comment); +const char *itip_view_get_comment (ItipView *view); + void itip_view_set_description (ItipView *view, const char *description); const char *itip_view_get_description (ItipView *view); |