Re: [evolution-patches] calendar and task source deletion



Rodrigo Moya wrote:
hmm, I think it doesn't, but not your fault, but the original code. It
is written in a way that will only remove calendars that are selected,
that is:

cal = e_cal_model_get_client_for_uri (gnome_calendar_get_calendar_model
(priv->calendar), uri);
if (cal)
	...

This will search the calendar in the view's model (which only contains
the calendars currently loaded). So, if the calendar is not loaded, the
source will be removed, but e_cal_remove won't be called for that
calendar, meaning that files won't be deleted for local calendars,
folders won't be removed for remote calendars, etc

Oh, I see.  Thanks for the explanation.

I think one way around this is to do an e_cal_new if the cal isn't loaded already. From what I can see that is OK as long as e_cal_open isn't done too.

Updated patch attached.

Thanks,
Jon
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2223
diff -p -u -r1.2223 ChangeLog
--- ChangeLog	29 Mar 2004 15:46:25 -0000	1.2223
+++ ChangeLog	29 Mar 2004 17:55:55 -0000
@@ -1,3 +1,9 @@
+2004-03-29  William Jon McCann  <mccann jhu edu>
+
+	* gui/tasks-component.c (delete_task_list_cb): 
+	* gui/calendar-component.c (delete_calendar_cb):
+	don't require client to be loaded in order to remove the source
+
 2004-03-29  Hari Prasad Nadig  <hp ndeepak info>
 
 	* gui/goto-dialog.glade: Naming issue, Go to Date -> Select Date,
Index: gui/tasks-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/tasks-component.c,v
retrieving revision 1.57
diff -p -u -r1.57 tasks-component.c
--- gui/tasks-component.c	11 Feb 2004 15:56:54 -0000	1.57
+++ gui/tasks-component.c	29 Mar 2004 17:55:55 -0000
@@ -310,6 +310,8 @@ delete_task_list_cb (GtkWidget *widget, 
 		cal = e_cal_model_get_client_for_uri (
 			e_calendar_table_get_model (E_CALENDAR_TABLE (e_tasks_get_calendar_table (priv->tasks))),
 			uri);
+		if (!cal)
+			cal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_TODO);
 		g_free (uri);
 		if (cal) {
 			if (e_cal_remove (cal, NULL)) {
Index: gui/calendar-component.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/calendar-component.c,v
retrieving revision 1.154
diff -p -u -r1.154 calendar-component.c
--- gui/calendar-component.c	26 Mar 2004 20:38:03 -0000	1.154
+++ gui/calendar-component.c	29 Mar 2004 17:55:55 -0000
@@ -379,6 +379,8 @@ delete_calendar_cb (GtkWidget *widget, C
 		/* first, ask the backend to remove the calendar */
 		uri = e_source_get_uri (selected_source);
 		cal = e_cal_model_get_client_for_uri (gnome_calendar_get_calendar_model (priv->calendar), uri);
+		if (!cal)
+			cal = e_cal_new_from_uri (uri, E_CAL_SOURCE_TYPE_EVENT);
 		g_free (uri);
 		if (cal) {
 			if (e_cal_remove (cal, NULL)) {


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