evolution-data-server r9134 - in trunk/calendar: . backends/caldav backends/file backends/weather libedata-cal



Author: mcrha
Date: Fri Jul 18 14:03:01 2008
New Revision: 9134
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=9134&view=rev

Log:
2008-07-18  Milan Crha  <mcrha redhat com>

	** Fix for bug #515998

	* libedata-cal/e-cal-backend-util.h: (e_cal_backend_status_to_string):
	* libedata-cal/e-cal-backend-util.c: (e_cal_backend_status_to_string):
	New helper function to convert call status to the string.
	* backends/file/e-cal-backend-file.c: (e_cal_backend_file_remove):
	* backends/caldav/e-cal-backend-caldav.c: (caldav_remove):
	* backends/weather/e-cal-backend-weather.c:
	(e_cal_backend_weather_remove): On any error in remove calendar just
	print the message on the console and return success.



Modified:
   trunk/calendar/ChangeLog
   trunk/calendar/backends/caldav/e-cal-backend-caldav.c
   trunk/calendar/backends/file/e-cal-backend-file.c
   trunk/calendar/backends/weather/e-cal-backend-weather.c
   trunk/calendar/libedata-cal/e-cal-backend-util.c
   trunk/calendar/libedata-cal/e-cal-backend-util.h

Modified: trunk/calendar/backends/caldav/e-cal-backend-caldav.c
==============================================================================
--- trunk/calendar/backends/caldav/e-cal-backend-caldav.c	(original)
+++ trunk/calendar/backends/caldav/e-cal-backend-caldav.c	Fri Jul 18 14:03:01 2008
@@ -1611,10 +1611,9 @@
 
 	status = check_state (cbdav, &online);
 
-	if (status != GNOME_Evolution_Calendar_Success) {
-		g_mutex_unlock (priv->lock);
-		return status;
-	}
+	/* lie here a bit, but otherwise the calendar will not be removed, even it should */
+	if (status != GNOME_Evolution_Calendar_Success)
+		g_print (G_STRLOC ": %s", e_cal_backend_status_to_string (status));
 
 	e_file_cache_remove (E_FILE_CACHE (priv->cache));
 	priv->cache  = NULL;

Modified: trunk/calendar/backends/file/e-cal-backend-file.c
==============================================================================
--- trunk/calendar/backends/file/e-cal-backend-file.c	(original)
+++ trunk/calendar/backends/file/e-cal-backend-file.c	Fri Jul 18 14:03:01 2008
@@ -1022,7 +1022,12 @@
         g_free (full_path);
 
         g_static_rec_mutex_unlock (&priv->idle_save_rmutex);
-        return status;
+
+	/* lie here a bit, but otherwise the calendar will not be removed, even it should */
+	if (status != GNOME_Evolution_Calendar_Success)
+		g_print (G_STRLOC ": %s", e_cal_backend_status_to_string (status));
+
+        return GNOME_Evolution_Calendar_Success;
 }
 
 /* is_loaded handler for the file backend */

Modified: trunk/calendar/backends/weather/e-cal-backend-weather.c
==============================================================================
--- trunk/calendar/backends/weather/e-cal-backend-weather.c	(original)
+++ trunk/calendar/backends/weather/e-cal-backend-weather.c	Fri Jul 18 14:03:01 2008
@@ -495,8 +495,11 @@
 	cbw = E_CAL_BACKEND_WEATHER (backend);
 	priv = cbw->priv;
 
-	if (!priv->cache)
-		return GNOME_Evolution_Calendar_OtherError;
+	if (!priv->cache) {
+		/* lie here a bit, but otherwise the calendar will not be removed, even it should */
+		g_print (G_STRLOC ": Doesn't have a cache?!?");
+		return GNOME_Evolution_Calendar_Success;
+	}
 
 	e_file_cache_remove (E_FILE_CACHE (priv->cache));
 	return GNOME_Evolution_Calendar_Success;

Modified: trunk/calendar/libedata-cal/e-cal-backend-util.c
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend-util.c	(original)
+++ trunk/calendar/libedata-cal/e-cal-backend-util.c	Fri Jul 18 14:03:01 2008
@@ -19,7 +19,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <string.h>
+#include <glib/gi18n-lib.h>
 #include "e-cal-backend-util.h"
 #include "libedataserver/e-account-list.h"
 
@@ -76,3 +81,64 @@
 
 	return account != NULL;
 }
+
+/**
+ * e_cal_backend_status_to_string:
+ *
+ * Converts status code to string.
+ **/
+const char *
+e_cal_backend_status_to_string (GNOME_Evolution_Calendar_CallStatus status)
+{
+	switch (status) {
+	case GNOME_Evolution_Calendar_Success:
+		return _("No error");
+	case GNOME_Evolution_Calendar_RepositoryOffline:
+		return _("Repository is offline");
+	case GNOME_Evolution_Calendar_PermissionDenied:
+		return _("Permission denied");
+	case GNOME_Evolution_Calendar_InvalidRange:
+		return _("Invalid range");
+	case GNOME_Evolution_Calendar_ObjectNotFound:
+		return _("Object not found");
+	case GNOME_Evolution_Calendar_InvalidObject:
+		return _("Invalid object");
+	case GNOME_Evolution_Calendar_ObjectIdAlreadyExists:
+		return _("Object ID already exists");
+	case GNOME_Evolution_Calendar_AuthenticationFailed:
+		return _("Authentication failed");
+	case GNOME_Evolution_Calendar_AuthenticationRequired:
+		return _("Authentication required");
+	case GNOME_Evolution_Calendar_UnsupportedField:
+		return _("Unsupported field");
+	case GNOME_Evolution_Calendar_UnsupportedMethod:
+		return _("Unsupported method");
+	case GNOME_Evolution_Calendar_UnsupportedAuthenticationMethod:
+		return _("Unsupported authentication method");
+	case GNOME_Evolution_Calendar_TLSNotAvailable:
+		return _("TLS not available");
+	case GNOME_Evolution_Calendar_NoSuchCal:
+		return _("No such calendar");
+	case GNOME_Evolution_Calendar_UnknownUser:
+		return _("Unknown User");
+	case GNOME_Evolution_Calendar_OfflineUnavailable:
+		return _("Offline unavailable");
+	case GNOME_Evolution_Calendar_SearchSizeLimitExceeded:
+		return _("Search size limit exceeded");
+	case GNOME_Evolution_Calendar_SearchTimeLimitExceeded:
+		return _("Search time limit exceeded");
+	case GNOME_Evolution_Calendar_InvalidQuery:
+		return _("Invalid query");
+	case GNOME_Evolution_Calendar_QueryRefused:
+		return _("Query refused");
+	case GNOME_Evolution_Calendar_CouldNotCancel:
+		return _("Could not cancel operation");
+	default:
+	case GNOME_Evolution_Calendar_OtherError:
+		return _("Unknown error");
+	case GNOME_Evolution_Calendar_InvalidServerVersion:
+		return _("Invalid server version");
+	}
+
+	return NULL;
+}

Modified: trunk/calendar/libedata-cal/e-cal-backend-util.h
==============================================================================
--- trunk/calendar/libedata-cal/e-cal-backend-util.h	(original)
+++ trunk/calendar/libedata-cal/e-cal-backend-util.h	Fri Jul 18 14:03:01 2008
@@ -33,6 +33,8 @@
 gboolean e_cal_backend_mail_account_get_default (char **address, char **name);
 gboolean e_cal_backend_mail_account_is_valid (char *user, char **name);
 
+const char *e_cal_backend_status_to_string (GNOME_Evolution_Calendar_CallStatus status);
+
 G_END_DECLS
 
 #endif



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