[tracker/evolution-plugin: 3/4] plugins, evolution: Make the Evolution plugin work with old Evolution version



commit d737b4a3fd87be98f8e42b772cab52422c769e2a
Author: Philip Van Hoof <philip codeminded be>
Date:   Fri Mar 18 19:14:53 2011 +0100

    plugins, evolution: Make the Evolution plugin work with old Evolution version

 configure.ac                                     |   18 ++++++++++++++----
 src/plugins/evolution/tracker-evolution-plugin.c |   19 +++++++++++++++++--
 2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 192dfc4..605e489 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,10 +188,10 @@ LIBFLAC_REQUIRED=1.2.1
 LIBEXIF_REQUIRED=0.6
 LIBGSF_REQUIRED=1.13
 EXEMPI_REQUIRED=2.1.0
-EVO_REQUIRED=2.91.90
-EVO_SHELL_REQUIRED=2.91.90
-EDS_REQUIRED=2.91.90
-CAMEL_REQUIRED=2.91.90
+EVO_REQUIRED=2.32.0
+EVO_SHELL_REQUIRED=2.32.0
+EDS_REQUIRED=2.32.0
+CAMEL_REQUIRED=2.32.0
 # Unlikely version for now, Nepomuk integration isn't finished in streamanalyzer atm
 LIBSTREAMANALYZER_REQUIRED=0.7.0
 GEE_REQUIRED=0.3
@@ -370,6 +370,7 @@ if test "x$have_tracker_miner_evolution" != "xyes"; then
    PKG_CHECK_MODULES(TRACKER_MINER_EVOLUTION, [$TRACKER_MINER_EVOLUTION_REQUIRED],
                      [have_tracker_miner_evolution=yes],
                      [have_tracker_miner_evolution=no])
+
 fi
 
 # Check requirements for tracker-miner-rss
@@ -1122,6 +1123,11 @@ else
 fi
 
 if test "x$have_tracker_miner_evolution" = "xyes"; then
+
+   PKG_CHECK_MODULES(MINER_EVOLUTION_SHELL, evolution-shell > 2.91,
+                     [miner_evolution_2_91=yes],
+                     [miner_evolution_2_91=no])
+
    AC_ARG_WITH([evolution_plugin_dir],
                AS_HELP_STRING([--with-evolution-plugin-dir],
                               [path to Evolution plugin directory]))
@@ -1134,6 +1140,10 @@ if test "x$have_tracker_miner_evolution" = "xyes"; then
    if test -z $tracker_miner_evolution_install_dir; then
       AC_MSG_ERROR([Couldn't find evolution plugin dir, consider using --with-evolution-plugin-dir.])
    fi
+
+   if test "x$miner_evolution_2_91" = "xyes"; then
+      AC_DEFINE(EVOLUTION_SHELL_2_91, 1, [Use new evolution-shell API])
+   fi
 fi
 
 TRACKER_MINER_EVOLUTION_INSTALL_DIR=$tracker_miner_evolution_install_dir
diff --git a/src/plugins/evolution/tracker-evolution-plugin.c b/src/plugins/evolution/tracker-evolution-plugin.c
index b4a0046..f2e9073 100644
--- a/src/plugins/evolution/tracker-evolution-plugin.c
+++ b/src/plugins/evolution/tracker-evolution-plugin.c
@@ -46,7 +46,12 @@
 #include <mail/em-utils.h>
 #include <mail/mail-ops.h>
 
+#ifdef EVOLUTION_SHELL_2_91
 #include <mail/e-mail-session.h>
+#else 
+#include <mail/mail-session.h>
+#endif
+
 #include <mail/e-mail-backend.h>
 #include <shell/e-shell.h>
 
@@ -188,7 +193,9 @@ static TrackerEvolutionPlugin *manager = NULL;
 static GStaticRecMutex glock = G_STATIC_REC_MUTEX_INIT;
 static guint register_count = 0, walk_count = 0;
 static ThreadPool *folder_pool = NULL;
+#ifdef EVOLUTION_SHELL_2_91
 static EMailSession *session = NULL;
+#endif
 
 /* Prototype declarations */
 static void register_account (TrackerEvolutionPlugin *self, EAccount *account);
@@ -1406,7 +1413,10 @@ register_walk_folders_in_folder (TrackerEvolutionPlugin *self,
 		/* This is asynchronous and hooked to the mail/ API, so nicely
 		 * integrated with the Evolution UI application */
 
-		mail_get_folder (session,
+		mail_get_folder (
+#ifdef EVOLUTION_SHELL_2_91
+		                 session,
+#endif
 		                 iter->uri,
 		                 0,
 		                 register_on_get_folder,
@@ -1480,7 +1490,10 @@ unregister_walk_folders_in_folder (TrackerEvolutionPlugin *self,
 		/* This is asynchronous and hooked to the mail/ API, so nicely
 		 * integrated with the Evolution UI application */
 
-		mail_get_folder (session,
+		mail_get_folder (
+#ifdef EVOLUTION_SHELL_2_91
+		                 session,
+#endif
 		                 titer->uri,
 		                 0,
 		                 unregister_on_get_folder,
@@ -2236,6 +2249,7 @@ tracker_evolution_plugin_init (TrackerEvolutionPlugin *plugin)
 	TrackerEvolutionPluginPrivate *priv = TRACKER_EVOLUTION_PLUGIN_GET_PRIVATE (plugin);
 	EIterator *it;
 
+#ifdef EVOLUTION_SHELL_2_91
 	if (!session) {
 		EShell *shell;
 		EShellBackend *shell_backend;
@@ -2244,6 +2258,7 @@ tracker_evolution_plugin_init (TrackerEvolutionPlugin *plugin)
 		shell_backend = e_shell_get_backend_by_name (shell, "mail");
 		session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
 	}
+#endif
 
 	priv->connection = NULL;
 	priv->last_time = 0;



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