From 30717998cac73c0a2199e7b96fa2399113decd4a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 25 Nov 2011 16:45:28 +0100 Subject: Bug #580394 - Comment field in a meeting request is too small --- plugins/itip-formatter/itip-formatter.c | 7 +++++-- plugins/itip-formatter/itip-view.c | 36 ++++++++++++++++++++++++--------- plugins/itip-formatter/itip-view.h | 2 +- 3 files changed, 32 insertions(+), 13 deletions(-) (limited to 'plugins/itip-formatter') diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 7a66508500..916a853652 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -726,7 +726,7 @@ decrease_find_data (FormatItipFindData *fd) * * invitiations (REQUEST), but not replies (REPLY). * Replies only make sense for events with an organizer. */ - if (pitip->current_client && !e_cal_client_check_save_schedules (pitip->current_client) && + if ((!pitip->current_client || !e_cal_client_check_save_schedules (pitip->current_client)) && (pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) && pitip->has_organizer) { rsvp_enabled = TRUE; @@ -1376,7 +1376,8 @@ finish_message_delete_with_rsvp (struct _itip_puri *pitip, icalcomponent *ical_comp; icalproperty *prop; icalvalue *value; - const gchar *attendee, *comment; + const gchar *attendee; + gchar *comment; GSList *l, *list = NULL; gboolean found; @@ -1435,6 +1436,8 @@ finish_message_delete_with_rsvp (struct _itip_puri *pitip, comments.next = NULL; e_cal_component_set_comment_list (comp, &comments); + + g_free (comment); } e_cal_component_rescan (comp); diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index eb08828ed9..252883662e 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -107,7 +107,7 @@ struct _ItipViewPrivate { GtkWidget *rsvp_box; GtkWidget *rsvp_check; GtkWidget *rsvp_comment_header; - GtkWidget *rsvp_comment_entry; + GtkWidget *rsvp_comment_text; gboolean rsvp_show; GtkWidget *recur_box; @@ -964,7 +964,7 @@ rsvp_toggled_cb (GtkWidget *widget, rsvp = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check)); gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp); + gtk_widget_set_sensitive (priv->rsvp_comment_text, rsvp); } static void @@ -998,6 +998,7 @@ itip_view_init (ItipView *view) { ItipViewPrivate *priv; GtkWidget *icon, *vbox, *hbox, *separator, *table, *label; + GtkWidget *scrolled_window; priv = g_new0 (ItipViewPrivate, 1); view->priv = priv; @@ -1145,14 +1146,22 @@ itip_view_init (ItipView *view) priv->rsvp_comment_header = gtk_label_new (_("Comment:")); gtk_label_set_selectable (GTK_LABEL (priv->rsvp_comment_header), TRUE); + gtk_misc_set_alignment (GTK_MISC (priv->rsvp_comment_header), 0.0, 0.0); gtk_widget_set_sensitive (priv->rsvp_comment_header, FALSE); gtk_widget_show (priv->rsvp_comment_header); gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_header, FALSE, FALSE, 0); - priv->rsvp_comment_entry = gtk_entry_new (); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, FALSE); - gtk_widget_show (priv->rsvp_comment_entry); - gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_entry, FALSE, TRUE, 0); + scrolled_window = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (scrolled_window), 120); + gtk_widget_show (scrolled_window); + gtk_box_pack_start (GTK_BOX (hbox), scrolled_window, TRUE, TRUE, 0); + + priv->rsvp_comment_text = gtk_text_view_new (); + gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (priv->rsvp_comment_text), GTK_WRAP_WORD_CHAR); + gtk_widget_set_sensitive (priv->rsvp_comment_text, FALSE); + gtk_widget_show (priv->rsvp_comment_text); + gtk_container_add (GTK_CONTAINER (scrolled_window), priv->rsvp_comment_text); /* RSVP area */ priv->update_box = gtk_vbox_new (FALSE, 12); @@ -2036,7 +2045,7 @@ itip_view_set_rsvp (ItipView *view, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->rsvp_check), rsvp); gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp); + gtk_widget_set_sensitive (priv->rsvp_comment_text, rsvp); } gboolean @@ -2142,26 +2151,33 @@ itip_view_set_rsvp_comment (ItipView *view, const gchar *comment) { ItipViewPrivate *priv; + GtkTextBuffer *text_buffer; g_return_if_fail (view != NULL); g_return_if_fail (ITIP_IS_VIEW (view)); priv = view->priv; - gtk_entry_set_text (GTK_ENTRY (priv->rsvp_comment_entry), comment); + text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->rsvp_comment_text)); + gtk_text_buffer_set_text (text_buffer, comment, -1); } -const gchar * +gchar * itip_view_get_rsvp_comment (ItipView *view) { ItipViewPrivate *priv; + GtkTextBuffer *text_buffer; + GtkTextIter start, end; g_return_val_if_fail (view != NULL, NULL); g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); priv = view->priv; - return gtk_entry_get_text (GTK_ENTRY (priv->rsvp_comment_entry)); + text_buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (priv->rsvp_comment_text)); + gtk_text_buffer_get_bounds (text_buffer, &start, &end); + + return gtk_text_buffer_get_text (text_buffer, &start, &end, FALSE); } void diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h index d68ebdf9a9..538306c822 100644 --- a/plugins/itip-formatter/itip-view.h +++ b/plugins/itip-formatter/itip-view.h @@ -167,7 +167,7 @@ void itip_view_set_show_update (ItipView *view, gboolean update); gboolean itip_view_get_show_update (ItipView *view); void itip_view_set_rsvp_comment (ItipView *view, const gchar *comment); -const gchar *itip_view_get_rsvp_comment (ItipView *view); +gchar *itip_view_get_rsvp_comment (ItipView *view); void itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive); gboolean itip_view_get_buttons_sensitive (ItipView *view); -- cgit v1.2.3