[evolution-patches] patch for calendar migration



This is not totally necessary, but at least it will show up better
warning messages. Not sure if we want it for 2.0.x so that we get that
in bug reports for #69566
-- 
Rodrigo Moya <rodrigo novell com>
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2665
diff -u -p -r1.2665 ChangeLog
--- ChangeLog	15 Feb 2005 14:18:26 -0000	1.2665
+++ ChangeLog	15 Feb 2005 18:50:00 -0000
@@ -1,3 +1,8 @@
+2005-02-15  Rodrigo Moya <rodrigo novell com>
+
+	* gui/migration.c (migrate_ical_folder_to_source): check return value
+	from e_cal_new, to display a better warning message.
+
 2005-02-11  Rodrigo Moya <rodrigo novell com>
 
 	Fixes #72038
Index: gui/migration.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/migration.c,v
retrieving revision 1.33
diff -u -p -r1.33 migration.c
--- gui/migration.c	7 Jan 2005 11:36:53 -0000	1.33
+++ gui/migration.c	15 Feb 2005 18:50:00 -0000
@@ -318,14 +318,20 @@ migrate_ical_folder_to_source (char *old
 
 	dialog_set_folder_name (e_source_peek_name (new_source));
 
-	old_ecal = e_cal_new (old_source, type);
+	if (!(old_ecal = e_cal_new (old_source, type))) {
+		g_warning ("could not find a backend for '%s'", e_source_get_uri (old_source));
+		goto finish;
+	}
 	if (!e_cal_open (old_ecal, TRUE, &error)) {
 		g_warning ("failed to load source ecal for migration: '%s' (%s)", error->message,
 			   e_source_get_uri (old_source));
 		goto finish;
 	}
 
-	new_ecal = e_cal_new (new_source, type);
+	if (!(new_ecal = e_cal_new (new_source, type))) {
+		g_warning ("could not find a backend for '%s'", e_source_get_uri (new_source));
+		goto finish;
+	}
 	if (!e_cal_open (new_ecal, FALSE, &error)) {
 		g_warning ("failed to load destination ecal for migration: '%s' (%s)", error->message,
 			   e_source_get_uri (new_source));
@@ -336,7 +342,8 @@ migrate_ical_folder_to_source (char *old
 
 finish:
 	g_clear_error (&error);
-	g_object_unref (old_ecal);
+	if (old_ecal)
+		g_object_unref (old_ecal);
 	g_object_unref (group);
 	if (new_ecal)
 		g_object_unref (new_ecal);


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