aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/itip-formatter
diff options
context:
space:
mode:
authorChenthill Palanisamy <pchen@src.gnome.org>2005-07-11 10:48:18 +0800
committerChenthill Palanisamy <pchen@src.gnome.org>2005-07-11 10:48:18 +0800
commit45057ab2e503cba209411f7dcf87fb200e3b01ed (patch)
tree9b008b6c929d4e0ab5f34f0076077217821a0f37 /plugins/itip-formatter
parent24c212a1e2f400804387484b7515823dde4fce4b (diff)
downloadgsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar.gz
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar.bz2
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar.lz
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar.xz
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.tar.zst
gsoc2013-evolution-45057ab2e503cba209411f7dcf87fb200e3b01ed.zip
Support for groupwise recurrences.
svn path=/trunk/; revision=29704
Diffstat (limited to 'plugins/itip-formatter')
-rw-r--r--plugins/itip-formatter/ChangeLog12
-rw-r--r--plugins/itip-formatter/itip-formatter.c37
-rw-r--r--plugins/itip-formatter/itip-view.c55
-rw-r--r--plugins/itip-formatter/itip-view.h4
4 files changed, 103 insertions, 5 deletions
diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog
index ca449c1a9b..817393b09c 100644
--- a/plugins/itip-formatter/ChangeLog
+++ b/plugins/itip-formatter/ChangeLog
@@ -1,3 +1,15 @@
+2005-07-11 Harish Krishnaswamy <kharish@novell.com>
+
+ * itip-formatter.c (source_selected_cb),
+ (find_cal_opened_cb), (extract_itip_data): enable the
+ 'Apply to all instances' option for gw recurrence instances.
+ (view_response_cb): embed X-GW-RECUR-INSTANCE-MOD-TYPE property in the
+ component to indicate whether the accept/decline status applies
+ to the instance or the entire group.
+ * itip-view.[ch]: (set_buttons), (recur_toggled_cb), (itip_view_init),
+ (itip_view_get_recur_check_state), (itip_view_set_show_recur_check):
+ utility methods to manipulate the recur_check widget.
+
2005-06-27 Tor Lillqvist <tml@novell.com>
* Makefile.am: Use NO_UNDEFINED. Link with more libraries.
diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c
index 87204791fb..915718c4b4 100644
--- a/plugins/itip-formatter/itip-formatter.c
+++ b/plugins/itip-formatter/itip-formatter.c
@@ -334,6 +334,30 @@ source_selected_cb (ItipView *view, ESource *source, gpointer data)
itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE);
start_calendar_server (pitip, source, pitip->type, cal_opened_cb, pitip);
+ /* If it is a GW recurrence instance, enable the 'Apply to all
+ * instances' option */
+ if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER)) {
+ gboolean is_instance = FALSE;
+ icalcomponent *icalcomp = e_cal_component_get_icalcomponent (pitip->comp);
+ icalproperty *icalprop;
+
+ icalprop = icalcomponent_get_first_property (icalcomp, ICAL_X_PROPERTY);
+ while (icalprop) {
+ const char *x_name;
+
+ x_name = icalproperty_get_x_name (icalprop);
+ if (!strcmp (x_name, "X-GW-RECURRENCE-KEY")) {
+ is_instance = TRUE;
+ break;
+ }
+ icalprop = icalcomponent_get_next_property (icalcomp, ICAL_X_PROPERTY);
+ }
+ if (is_instance)
+ itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
+ else
+ itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), FALSE);
+ }
+
}
static void
@@ -404,6 +428,9 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data)
"Found the appointment in the calendar '%s'", e_source_peek_name (source));
set_buttons_sensitive (pitip);
+ if (e_cal_get_static_capability (pitip->current_ecal, CAL_STATIC_CAPABILITY_RECURRENCES_NO_MASTER))
+ itip_view_set_show_recur_check (ITIP_VIEW (pitip->view), TRUE);
+
}
zone = calendar_config_get_icaltimezone ();
@@ -1099,7 +1126,7 @@ extract_itip_data (FormatItipPObject *pitip, GtkContainer *container)
return FALSE;
}
-
+
prop = icalcomponent_get_first_property (pitip->main_comp, ICAL_METHOD_PROPERTY);
if (prop == NULL) {
pitip->method = ICAL_METHOD_PUBLISH;
@@ -1291,10 +1318,18 @@ view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data)
{
FormatItipPObject *pitip = data;
gboolean status = FALSE;
+ icalproperty *prop;
+
if (!pitip->my_address && pitip->current_ecal != NULL)
e_cal_get_cal_address (pitip->current_ecal, &pitip->my_address, NULL);
+ /* check if it is a recur instance (no master object) and
+ * add a property */
+ prop = icalproperty_new_x ("All");
+ icalproperty_set_x_name (prop, "X-GW-RECUR-INSTANCES-MOD-TYPE");
+ icalcomponent_add_property (e_cal_component_get_icalcomponent (pitip->comp), prop);
+
switch (response) {
case ITIP_VIEW_RESPONSE_ACCEPT:
status = change_status (pitip->ical_comp, pitip->my_address,
diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c
index acfcf9527f..67a067eae9 100644
--- a/plugins/itip-formatter/itip-view.c
+++ b/plugins/itip-formatter/itip-view.c
@@ -112,6 +112,9 @@ struct _ItipViewPrivate {
GtkWidget *rsvp_comment_entry;
gboolean rsvp_show;
+ GtkWidget *recur_box;
+ GtkWidget *recur_check;
+
GtkWidget *update_box;
GtkWidget *update_check;
gboolean update_show;
@@ -689,9 +692,11 @@ static void
set_buttons (ItipView *view)
{
ItipViewPrivate *priv;
-
+ gboolean is_recur_set = FALSE;
+
priv = view->priv;
+ is_recur_set = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->recur_check));
gtk_container_foreach (GTK_CONTAINER (priv->button_box), (GtkCallback) gtk_widget_destroy, NULL);
/* Everything gets the open button */
@@ -703,9 +708,9 @@ set_buttons (ItipView *view)
set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_REQUEST:
- 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);
+ set_one_button (view, is_recur_set ? "_Decline all" : "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
+ set_one_button (view, is_recur_set ? "_Tentative all" : "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE);
+ set_one_button (view, is_recur_set ? "_Accept all" : "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT);
break;
case ITIP_VIEW_MODE_ADD:
set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE);
@@ -811,6 +816,20 @@ rsvp_toggled_cb (GtkWidget *widget, gpointer data)
}
static void
+recur_toggled_cb (GtkWidget *widget, gpointer data)
+{
+ ItipView *view = data;
+ ItipViewPrivate *priv;
+ gboolean is_recur;
+
+ priv = view->priv;
+
+ is_recur = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->recur_check));
+ itip_view_set_mode (view, priv->mode);
+}
+
+
+static void
itip_view_init (ItipView *view)
{
ItipViewPrivate *priv;
@@ -961,6 +980,16 @@ itip_view_init (ItipView *view)
gtk_widget_show (priv->update_check);
gtk_box_pack_start (GTK_BOX (priv->update_box), priv->update_check, FALSE, FALSE, 0);
+ /* The recurrence check button */
+ priv->recur_box = gtk_vbox_new (FALSE, 12);
+ gtk_widget_show (priv->recur_box);
+ gtk_box_pack_start (GTK_BOX (vbox), priv->recur_box, FALSE, FALSE, 0);
+
+ priv->recur_check = gtk_check_button_new_with_mnemonic (_("A_pply to all instances"));
+ gtk_box_pack_start (GTK_BOX (priv->recur_box), priv->recur_check, FALSE, FALSE, 0);
+
+ g_signal_connect (priv->recur_check, "toggled", G_CALLBACK (recur_toggled_cb), view);
+
/* 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);
@@ -1847,4 +1876,22 @@ itip_view_get_buttons_sensitive (ItipView *view)
return priv->buttons_sensitive;
}
+gboolean
+itip_view_get_recur_check_state (ItipView *view)
+{
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (view->priv->recur_check));
+}
+
+void
+itip_view_set_show_recur_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->recur_check);
+ else {
+ gtk_widget_hide (view->priv->recur_check);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (view->priv->recur_check), FALSE);
+ }
+}
diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h
index d05bd4479c..4e47594270 100644
--- a/plugins/itip-formatter/itip-view.h
+++ b/plugins/itip-formatter/itip-view.h
@@ -165,6 +165,10 @@ const char *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);
+void itip_view_set_show_recur_check (ItipView *view, gboolean show);
+gboolean itip_view_get_recur_check_state (ItipView *view);
+
+
G_END_DECLS
#endif