[gnome-pilot/dbus] E-D-S Conduits: Adapt file paths for E-D-S 2.31.6 and beyond



commit c9c5206696d12dcfb24de94ebbd101f60e061b0b
Author: Matthew Barnes <mbarnes redhat com>
Date:   Sun Aug 1 09:30:20 2010 -0400

    E-D-S Conduits: Adapt file paths for E-D-S 2.31.6 and beyond
    
    As of version 2.31.6, Evolution-Data-Server complies with the XDG Base
    Directory Specification [1], which means ~/.evolution is no longer used.
    
    Compatibility with older versions is retained back to the version
    where the EDS_CHECK_VERSION macro was introduced (2.22 or 2.24?).
    
    [1] http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

 conduits/evolution-data-server/address-conduit.c  |   15 ++++++++++++-
 conduits/evolution-data-server/calendar-conduit.c |   22 ++++++++++++++++----
 conduits/evolution-data-server/memo-conduit.c     |   13 +++++++++++-
 conduits/evolution-data-server/todo-conduit.c     |   13 +++++++++++-
 4 files changed, 54 insertions(+), 9 deletions(-)
---
diff --git a/conduits/evolution-data-server/address-conduit.c b/conduits/evolution-data-server/address-conduit.c
index 4be77b8..78f8384 100644
--- a/conduits/evolution-data-server/address-conduit.c
+++ b/conduits/evolution-data-server/address-conduit.c
@@ -36,6 +36,8 @@
 #include <pi-appinfo.h>
 #include <libedataserver/e-categories.h>
 #include <libedataserver/e-url.h>
+#include <libedataserver/eds-version.h>
+#include <libedataserver/e-data-server-util.h>
 #include <libedataserverui/e-passwords.h>
 #include <libebook/e-book.h>
 #include <gpilotd/gnome-pilot-conduit.h>
@@ -791,9 +793,18 @@ static gchar *print_remote (GnomePilotRecord *remote)
 static gchar *
 map_name (EAddrConduitContext *ctxt)
 {
-	gchar *filename = NULL;
+	gchar *basename;
+	gchar *filename;
+
+	basename = g_strdup_printf ("pilot-map-%d.xml", ctxt->cfg->pilot_id);
+
+#if EDS_CHECK_VERSION(2,31,6)
+	filename = g_build_filename (e_get_user_data_dir (), "addressbook", "system", basename, NULL);
+#else
+	filename = g_build_filename (g_get_home_dir (), ".evolution", "addressbook", "local", "system", basename, NULL);
+#endif
 
-	filename = g_strdup_printf ("%s/.evolution/addressbook/local/system/pilot-map-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id);
+	g_free (basename);
 
 	return filename;
 }
diff --git a/conduits/evolution-data-server/calendar-conduit.c b/conduits/evolution-data-server/calendar-conduit.c
index 4456b76..5516bde 100644
--- a/conduits/evolution-data-server/calendar-conduit.c
+++ b/conduits/evolution-data-server/calendar-conduit.c
@@ -30,6 +30,8 @@
 #include <libecal/e-cal.h>
 #include <libecal/e-cal-time-util.h>
 #include <libedataserver/e-url.h>
+#include <libedataserver/eds-version.h>
+#include <libedataserver/e-data-server-util.h>
 #include <libedataserverui/e-passwords.h>
 #include <pi-source.h>
 #include <pi-socket.h>
@@ -161,9 +163,11 @@ calconduit_load_configuration (guint32 pilot_id)
 
 			if (!strcmp (path, "evolution/local/Calendar/calendar.ics")) {
 				gchar *new_filename =
-					g_build_filename (home,
-							  ".evolution/calendar/local/system/calendar.ics",
-							  NULL);
+#if EDS_CHECK_VERSION(2,31,6)
+					g_build_filename (e_get_user_data_dir (), "calendar", "system", "calendar.ics", NULL);
+#else
+					g_build_filename (home, ".evolution", "calendar", "local", "system", "calendar.ics", NULL);
+#endif
 				/* need to upgrade the last_uri. yay. */
 				g_free (c->last_uri);
 				c->last_uri = g_filename_to_uri (new_filename, NULL, NULL);
@@ -544,10 +548,18 @@ get_default_timezone (void)
 static gchar *
 map_name (ECalConduitContext *ctxt)
 {
+	gchar *basename;
 	gchar *filename;
 
-	filename = g_strdup_printf ("%s/.evolution/calendar/local/system/pilot-map-calendar-%d.xml",
-				    g_get_home_dir (), ctxt->cfg->pilot_id);
+	basename = g_strdup_printf ("pilot-map-calendar-%d.xml", ctxt->cfg->pilot_id);
+
+#if EDS_CHECK_VERSION(2,31,6)
+	filename = g_build_filename (e_get_user_data_dir (), "calendar", "system", basename, NULL);
+#else
+	filename = g_build_filename (g_get_home_dir (), ".evolution", "calendar", "local", "system", basename, NULL);
+#endif
+
+	g_free (basename);
 
 	return filename;
 }
diff --git a/conduits/evolution-data-server/memo-conduit.c b/conduits/evolution-data-server/memo-conduit.c
index 33b36ee..0f64316 100644
--- a/conduits/evolution-data-server/memo-conduit.c
+++ b/conduits/evolution-data-server/memo-conduit.c
@@ -32,6 +32,8 @@
 #include <libecal/e-cal.h>
 #include <libecal/e-cal-time-util.h>
 #include <libedataserver/e-categories.h>
+#include <libedataserver/eds-version.h>
+#include <libedataserver/e-data-server-util.h>
 #include <pi-source.h>
 #include <pi-socket.h>
 #include <pi-dlp.h>
@@ -399,9 +401,18 @@ get_default_timezone (void)
 static gchar *
 map_name (EMemoConduitContext *ctxt)
 {
+	gchar *basename;
 	gchar *filename;
 
-	filename = g_strdup_printf ("%s/.evolution/memos/local/system/pilot-map-memo-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id);
+	basename = g_strdup_printf ("pilot-map-memo-%d.xml", ctxt->cfg->pilot_id);
+
+#if EDS_CHECK_VERSION(2,31,6)
+	filename = g_build_filename (e_get_user_data_dir (), "memos", "system", basename, NULL);
+#else
+	filename = g_build_filename (g_get_home_dir (), ".evolution", "memos", "local", "system", basename, NULL);
+#endif
+
+	g_free (basename);
 
 	return filename;
 }
diff --git a/conduits/evolution-data-server/todo-conduit.c b/conduits/evolution-data-server/todo-conduit.c
index 886d29a..6fe7735 100644
--- a/conduits/evolution-data-server/todo-conduit.c
+++ b/conduits/evolution-data-server/todo-conduit.c
@@ -32,8 +32,10 @@
 #include <libecal/e-cal.h>
 #include <libecal/e-cal-time-util.h>
 #include <libedataserver/e-url.h>
+#include <libedataserver/eds-version.h>
 #include <libedataserverui/e-passwords.h>
 #include <libedataserver/e-categories.h>
+#include <libedataserver/e-data-server-util.h>
 #include <pi-source.h>
 #include <pi-socket.h>
 #include <pi-dlp.h>
@@ -530,9 +532,18 @@ get_default_timezone (void)
 static gchar *
 map_name (EToDoConduitContext *ctxt)
 {
+	gchar *basename;
 	gchar *filename;
 
-	filename = g_strdup_printf ("%s/.evolution/tasks/local/system/pilot-map-todo-%d.xml", g_get_home_dir (), ctxt->cfg->pilot_id);
+	basename = g_strdup_printf ("pilot-map-todo-%d.xml", ctxt->cfg->pilot_id);
+
+#if EDS_CHECK_VERSION(2,31,6)
+	filename = g_build_filename (e_get_user_data_dir (), "tasks", "local", "system", basename, NULL);
+#else
+	filename = g_build_filename (g_get_home_dir (), ".evolution", "tasks", "local", "system", basename, NULL);
+#endif
+
+	g_free (basename);
 
 	return filename;
 }



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