[evolution-patches] add capabilities for THISANDPRIOR/THISANDFUTURE



Untested because I'm having trouble getting things to work. This adds
support for THISANDPRIOR to recur_comp_dialog but lets backends disable
that and/or THISANDFUTURE. (SunONE doesn't support THISANDPRIOR, which
is why there was no code to handle that in recur_comp_dialog before.
Exchange doesn't support either of them.)


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.1916
diff -u -r1.1916 ChangeLog
--- ChangeLog	29 Oct 2003 17:53:47 -0000	1.1916
+++ ChangeLog	29 Oct 2003 19:28:29 -0000
@@ -1,5 +1,22 @@
 2003-10-29  Dan Winship  <danw ximian com>
 
+	* cal-util/cal-util.h: Add CAL_STATIC_CAPABILITY_NO_THISANDFUTURE
+	and CAL_STATIC_CAPABILITY_NO_THISANDPRIOR
+
+	* gui/dialogs/recur-comp.c (recur_component_dialog): Add a
+	CalClient argument. Use cal_client_get_static_capability to decide
+	whether or not to offer THISANDFUTURE and THISANDPRIOR options
+
+	* gui/dialogs/comp-editor.c (prompt_to_save_changes, save_cmd,
+	save_close_cmd): Pass a CalClient to recur_component_dialog.
+
+	* gui/e-day-view.c (e_day_view_finish_long_event_resize,
+	e_day_view_finish_resize, e_day_view_on_editing_stopped,
+	e_day_view_on_top_canvas_drag_data_received,
+	e_day_view_on_main_canvas_drag_data_received): Likewise
+
+	* gui/e-week-view.c (e_week_view_on_editing_stopped): Likewise
+
 	* gui/calendar-component.c (impl_createControls): set an exception
 	if we fail, so evo won't crash.
 
Index: cal-util/cal-util.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/cal-util/cal-util.h,v
retrieving revision 1.32
diff -u -r1.32 cal-util.h
--- cal-util/cal-util.h	24 Oct 2003 14:39:25 -0000	1.32
+++ cal-util/cal-util.h	29 Oct 2003 19:28:29 -0000
@@ -115,6 +115,8 @@
 #define CAL_STATIC_CAPABILITY_NO_EMAIL_ALARMS             "no-email-alarms"
 #define CAL_STATIC_CAPABILITY_NO_PROCEDURE_ALARMS         "no-procedure-alarms"
 #define CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT          "no-task-assignment"
+#define CAL_STATIC_CAPABILITY_NO_THISANDFUTURE            "no-thisandfuture"
+#define CAL_STATIC_CAPABILITY_NO_THISANDPRIOR             "no-thisandprior"
 #define CAL_STATIC_CAPABILITY_NO_TRANSPARENCY             "no-transparency"
 #define CAL_STATIC_CAPABILITY_ONE_ALARM_ONLY              "one-alarm-only"
 #define CAL_STATIC_CAPABILITY_ORGANIZER_MUST_ATTEND       "organizer-must-attend"
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.225
diff -u -r1.225 e-day-view.c
--- gui/e-day-view.c	29 Oct 2003 13:27:23 -0000	1.225
+++ gui/e-day-view.c	29 Oct 2003 19:28:33 -0000
@@ -3755,7 +3755,7 @@
 	}
 	
  	if (cal_component_has_recurrences (comp)) {
- 		if (!recur_component_dialog (comp, &mod, NULL)) {
+ 		if (!recur_component_dialog (client, comp, &mod, NULL)) {
  			gtk_widget_queue_draw (day_view->top_canvas);
 			goto out;
  		}
@@ -3838,7 +3838,7 @@
 	day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
 
  	if (cal_component_has_recurrences (comp)) {
- 		if (!recur_component_dialog (comp, &mod, NULL)) {
+ 		if (!recur_component_dialog (client, comp, &mod, NULL)) {
  			gtk_widget_queue_draw (day_view->top_canvas);
 			goto out;
  		}
@@ -5657,6 +5657,7 @@
 	gchar *text = NULL;
 	CalComponentText summary;
 	CalComponent *comp;
+	CalClient *client;
 	gboolean on_server;
 	
 	/* Note: the item we are passed here isn't reliable, so we just stop
@@ -5703,7 +5704,8 @@
 	comp = cal_component_new ();
 	cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 
-	on_server = cal_comp_is_on_server (comp, event->comp_data->client);
+	client = event->comp_data->client;
+	on_server = cal_comp_is_on_server (comp, client);
 	
 	if (string_is_empty (text) && !on_server) {
 		const char *uid;
@@ -5734,24 +5736,24 @@
 		cal_component_set_summary (comp, &summary);
 
 		if (!on_server) {
-			if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL))
+			if (!cal_client_create_object (client, icalcomp, NULL, NULL))
 				g_message (G_STRLOC ": Could not create the object!");
 		} else {
 			CalObjModType mod = CALOBJ_MOD_ALL;
 			GtkWindow *toplevel;
 			if (cal_component_has_recurrences (comp)) {
-				if (!recur_component_dialog (comp, &mod, NULL)) {
+				if (!recur_component_dialog (client, comp, &mod, NULL)) {
 					goto out;
 				}
 			}
 			
 			/* FIXME When sending here, what exactly should we send? */
 			toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
-			if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) {
-				if (itip_organizer_is_user (comp, event->comp_data->client) 
-				    && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE))
+			if (cal_client_modify_object (client, icalcomp, mod, NULL)) {
+				if (itip_organizer_is_user (comp, client) 
+				    && send_component_dialog (toplevel, client, comp, FALSE))
 					itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, 
-							event->comp_data->client, NULL);
+							client, NULL);
 			}
 		}
 		
@@ -6850,7 +6852,7 @@
 				gnome_canvas_item_show (event->canvas_item);
 
 			if (cal_component_has_recurrences (comp)) {
-				if (!recur_component_dialog (comp, &mod, NULL))
+				if (!recur_component_dialog (client, comp, &mod, NULL))
 					return;
 			}
 
@@ -7044,7 +7046,7 @@
 				gnome_canvas_item_show (event->canvas_item);
 
 			if (cal_component_has_recurrences (comp)) {
-				if (!recur_component_dialog (comp, &mod, NULL)) {
+				if (!recur_component_dialog (client, comp, &mod, NULL)) {
 					g_object_unref (comp);
 					return;
 				}
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.189
diff -u -r1.189 e-week-view.c
--- gui/e-week-view.c	29 Oct 2003 15:41:46 -0000	1.189
+++ gui/e-week-view.c	29 Oct 2003 19:28:34 -0000
@@ -2988,6 +2988,7 @@
 	gchar *text = NULL;
 	CalComponent *comp;
 	CalComponentText summary;
+	CalClient *client;
 	const char *uid;
 	gboolean on_server;
 	
@@ -3020,7 +3021,8 @@
 	comp = cal_component_new ();
 	cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
 
-	on_server = cal_comp_is_on_server (comp, event->comp_data->client);
+	client = event->comp_data->client;
+	on_server = cal_comp_is_on_server (comp, client);
 	
 	if (string_is_empty (text) && !on_server) {
 		const char *uid;
@@ -3048,25 +3050,25 @@
 		cal_component_set_summary (comp, &summary);
 		
 		if (!on_server) {
-			if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL))
+			if (!cal_client_create_object (client, icalcomp, NULL, NULL))
 				g_message (G_STRLOC ": Could not create the object!");
 		} else {
 			CalObjModType mod = CALOBJ_MOD_ALL;
 			GtkWindow *toplevel;
 			
 			if (cal_component_has_recurrences (comp)) {
-				if (!recur_component_dialog (comp, &mod, NULL)) {
+				if (!recur_component_dialog (client, comp, &mod, NULL)) {
 					goto out;
 				}
 			}
 			
 			/* FIXME When sending here, what exactly should we send? */
 			toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view)));
-			if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) {
-				if (itip_organizer_is_user (comp, event->comp_data->client) 
-				    && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE))
+			if (cal_client_modify_object (client, icalcomp, mod, NULL)) {
+				if (itip_organizer_is_user (comp, client) 
+				    && send_component_dialog (toplevel, client, comp, FALSE))
 					itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, 
-							event->comp_data->client, NULL);
+							client, NULL);
 			}
 		}
 	}
Index: gui/dialogs/comp-editor.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/comp-editor.c,v
retrieving revision 1.83
diff -u -r1.83 comp-editor.c
--- gui/dialogs/comp-editor.c	21 Oct 2003 18:51:01 -0000	1.83
+++ gui/dialogs/comp-editor.c	29 Oct 2003 19:28:34 -0000
@@ -403,7 +403,7 @@
 	switch (save_component_dialog (GTK_WINDOW (editor))) {
 	case GTK_RESPONSE_YES: /* Save */
 		if (cal_component_is_instance (priv->comp))
-			if (!recur_component_dialog (priv->comp, &priv->mod, GTK_WINDOW (editor)))
+			if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
 				return FALSE;
 
 		if (send && save_comp_with_send (editor))
@@ -1235,7 +1235,7 @@
 	commit_all_fields (editor);
 
 	if (cal_component_is_instance (priv->comp))
-		if (!recur_component_dialog (priv->comp, &priv->mod, GTK_WINDOW (editor)))
+		if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
 			return;
 
 	save_comp_with_send (editor);
@@ -1252,7 +1252,7 @@
 	commit_all_fields (editor);
 
 	if (cal_component_is_instance (priv->comp))
-		if (!recur_component_dialog (priv->comp, &priv->mod, GTK_WINDOW (editor)))
+		if (!recur_component_dialog (priv->client, priv->comp, &priv->mod, GTK_WINDOW (editor)))
 			return;
 
 	if (save_comp_with_send (editor))
Index: gui/dialogs/recur-comp.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/recur-comp.c,v
retrieving revision 1.4
diff -u -r1.4 recur-comp.c
--- gui/dialogs/recur-comp.c	29 Jun 2003 19:29:46 -0000	1.4
+++ gui/dialogs/recur-comp.c	29 Oct 2003 19:28:34 -0000
@@ -32,12 +32,13 @@
 
 
 gboolean
-recur_component_dialog (CalComponent *comp,
+recur_component_dialog (CalClient *client,
+			CalComponent *comp,
 			CalObjModType *mod,
 			GtkWindow *parent)
 {
 	char *str;
-	GtkWidget *dialog, *rb1, *rb2, *rb3, *hbox;
+	GtkWidget *dialog, *rb_this, *rb_prior, *rb_future, *rb_all, *hbox;
 	CalComponentVType vtype;
 	gboolean ret;
 	
@@ -69,23 +70,35 @@
 	
 	hbox = gtk_hbox_new (FALSE, 2);
 	gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
-	rb1 = gtk_radio_button_new_with_label (NULL, _("This Instance Only"));
-	gtk_container_add (GTK_CONTAINER (hbox), rb1);
+	rb_this = gtk_radio_button_new_with_label (NULL, _("This Instance Only"));
+	gtk_container_add (GTK_CONTAINER (hbox), rb_this);
 
-	rb2 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb1), _("This and Future Instances"));
-	gtk_container_add (GTK_CONTAINER (hbox), rb2);	
-	rb3 = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb1), _("All Instances"));
-	gtk_container_add (GTK_CONTAINER (hbox), rb3);
+	if (!cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDPRIOR)) {
+		rb_prior = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Prior Instances"));
+		gtk_container_add (GTK_CONTAINER (hbox), rb_prior);
+	} else
+		rb_prior = NULL;
+
+	if (!cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_NO_THISANDFUTURE)) {
+		rb_future = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("This and Future Instances"));
+		gtk_container_add (GTK_CONTAINER (hbox), rb_future);
+	} else
+		rb_future = NULL;
+
+	rb_all = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (rb_this), _("All Instances"));
+	gtk_container_add (GTK_CONTAINER (hbox), rb_all);
 
 	gtk_widget_show_all (hbox);
 
 	ret = gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK;
 
-	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb1)))
+	if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_this)))
 		*mod = CALOBJ_MOD_THIS;
-	else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb2)))
+	else if (rb_prior && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_prior)))
+		*mod = CALOBJ_MOD_THISANDPRIOR;
+	else if (rb_future && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_future)))
 		*mod = CALOBJ_MOD_THISANDFUTURE;
-	else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb3)))
+	else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (rb_all)))
 		*mod = CALOBJ_MOD_ALL;
 
 	gtk_widget_destroy (dialog);
Index: gui/dialogs/recur-comp.h
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/dialogs/recur-comp.h,v
retrieving revision 1.4
diff -u -r1.4 recur-comp.h
--- gui/dialogs/recur-comp.h	29 Jun 2003 19:29:46 -0000	1.4
+++ gui/dialogs/recur-comp.h	29 Oct 2003 19:28:34 -0000
@@ -22,10 +22,12 @@
 #define RECUR_COMP_H
 
 #include <gtk/gtkwindow.h>
+#include <cal-client/cal-client.h>
 #include <cal-util/cal-component.h>
 #include <cal-util/cal-util.h>
 
-gboolean recur_component_dialog (CalComponent *comp,
+gboolean recur_component_dialog (CalClient *client,
+				 CalComponent *comp,
 				 CalObjModType *mod,
 				 GtkWindow *parent);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]