From 7dafe33520316eadd8ee9df234ba8eb5e6333160 Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Tue, 4 Dec 2007 11:08:15 +0000 Subject: ** Fix for bug #220846 2007-12-04 Milan Crha ** Fix for bug #220846 * itip-view.h: * itip-view.c: (itip_view_set_show_free_time_check), (itip_view_get_free_time_check_state), (struct _ItipViewPrivate), (itip_view_init): * itip-formatter.c: (view_response_cb), (format_itip_object): New option to accept meeting request as free time. svn path=/trunk/; revision=34640 --- plugins/itip-formatter/ChangeLog | 11 +++++++++++ plugins/itip-formatter/itip-formatter.c | 16 ++++++++++++---- plugins/itip-formatter/itip-view.c | 32 ++++++++++++++++++++++++++++++++ plugins/itip-formatter/itip-view.h | 3 +++ 4 files changed, 58 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog index bb4ae062d5..d4132aeb8f 100644 --- a/plugins/itip-formatter/ChangeLog +++ b/plugins/itip-formatter/ChangeLog @@ -1,3 +1,14 @@ +2007-12-04 Milan Crha + + ** Fix for bug #220846 + + * itip-view.h: + * itip-view.c: (itip_view_set_show_free_time_check), + (itip_view_get_free_time_check_state), (struct _ItipViewPrivate), + (itip_view_init): + * itip-formatter.c: (view_response_cb), (format_itip_object): + New option to accept meeting request as free time. + 2007-11-23 Milan Crha ** Fix for bug #458237 diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 4dabf551a8..a3bb6c2e80 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -1617,11 +1617,17 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) ECalComponentTransparency trans; gboolean flag; - e_cal_component_get_transparency (pitip->comp, &trans); - /* FIXME we should be providing an option to accept as free or busy */ - if (trans == E_CAL_COMPONENT_TRANSP_NONE) - e_cal_component_set_transparency (pitip->comp, E_CAL_COMPONENT_TRANSP_OPAQUE); + if (pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) { + if (itip_view_get_free_time_check_state (ITIP_VIEW (pitip->view))) + e_cal_component_set_transparency (pitip->comp, E_CAL_COMPONENT_TRANSP_TRANSPARENT); + else + e_cal_component_set_transparency (pitip->comp, E_CAL_COMPONENT_TRANSP_OPAQUE); + } else { + e_cal_component_get_transparency (pitip->comp, &trans); + if (trans == E_CAL_COMPONENT_TRANSP_NONE) + e_cal_component_set_transparency (pitip->comp, E_CAL_COMPONENT_TRANSP_OPAQUE); + } if (!pitip->to_address && pitip->current_ecal != NULL) e_cal_get_cal_address (pitip->current_ecal, &pitip->to_address, NULL); @@ -2140,6 +2146,8 @@ format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject if (response_enabled) { g_signal_connect (pitip->view, "response", G_CALLBACK (view_response_cb), pitip); + itip_view_set_show_free_time_check (ITIP_VIEW (pitip->view), pitip->type == E_CAL_SOURCE_TYPE_EVENT && (pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST)); + if (pitip->calendar_uid) pitip->current_ecal = start_calendar_server_by_uid (pitip, pitip->calendar_uid, pitip->type); else { diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c index fb60c4fa31..28596c2fba 100644 --- a/plugins/itip-formatter/itip-view.c +++ b/plugins/itip-formatter/itip-view.c @@ -122,6 +122,9 @@ struct _ItipViewPrivate { GtkWidget *update_check; gboolean update_show; + GtkWidget *options_box; + GtkWidget *free_time_check; + GtkWidget *button_box; gboolean buttons_sensitive; @@ -1109,6 +1112,13 @@ itip_view_init (ItipView *view) g_signal_connect (priv->recur_check, "toggled", G_CALLBACK (recur_toggled_cb), view); + priv->options_box = gtk_vbox_new (FALSE, 2); + gtk_widget_show (priv->options_box); + gtk_box_pack_start (GTK_BOX (vbox), priv->options_box, FALSE, FALSE, 0); + + priv->free_time_check = gtk_check_button_new_with_mnemonic (_("Show time as _free")); + gtk_box_pack_start (GTK_BOX (priv->options_box), priv->free_time_check, FALSE, FALSE, 0); + /* The buttons for actions */ priv->button_box = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (priv->button_box), GTK_BUTTONBOX_END); @@ -2095,3 +2105,25 @@ itip_view_set_show_recur_check (ItipView *view, gboolean show) gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->recur_check), FALSE); } } + +void +itip_view_set_show_free_time_check (ItipView *view, gboolean show) +{ + g_return_if_fail (view != NULL); + g_return_if_fail (ITIP_IS_VIEW (view)); + + if (show) + gtk_widget_show (view->priv->free_time_check); + else { + gtk_widget_hide (view->priv->free_time_check); + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->free_time_check), FALSE); + } +} + +gboolean +itip_view_get_free_time_check_state (ItipView *view) +{ + g_return_val_if_fail (view != NULL, FALSE); + + return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->free_time_check)); +} diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h index a93da5c53c..2e9f119642 100644 --- a/plugins/itip-formatter/itip-view.h +++ b/plugins/itip-formatter/itip-view.h @@ -177,6 +177,9 @@ gboolean itip_view_get_recur_check_state (ItipView *view); void itip_view_set_needs_decline (ItipView *view, gboolean needs_decline); +void itip_view_set_show_free_time_check (ItipView *view, gboolean show); +gboolean itip_view_get_free_time_check_state (ItipView *view); + G_END_DECLS #endif -- cgit