changeset 9046:c307cf4c84d2

[gaim-migrate @ 9822] The gevolution plugin should now compile with both the previous release of Evolution/e-d-s and with e-d-s CVS. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Sun, 23 May 2004 22:43:37 +0000
parents 38d022e5eb19
children 14e1a86899b9
files configure.ac plugins/gevolution/gevo-util.c plugins/gevolution/gevolution.h
diffstat 3 files changed, 33 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/configure.ac	Sun May 23 22:17:38 2004 +0000
+++ b/configure.ac	Sun May 23 22:43:37 2004 +0000
@@ -306,13 +306,23 @@
 AC_ARG_ENABLE(gevolution, [  --disable-gevolution    compile without the Gaim-Evolution plugin],,enable_gevolution=yes)
 
 if test "x$enable_gevolution" = "xyes"; then
-
 	evo_deps="libxml-2.0 libebook-1.0 libedata-book-1.0"
 	PKG_CHECK_MODULES(EVOLUTION_ADDRESSBOOK, $evo_deps, build_gevo=yes, build_gevo=no)
 
 	AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
 	AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
 
+	dnl This can be removed in a few releases of Evolution, especially when
+	dnl it goes stable!
+	AC_MSG_CHECKING([libebook version])
+	LIBEBOOK_VERSION=`$PKG_CONFIG --modversion libebook-1.0`
+	LIBEBOOK_MAJOR_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
+	LIBEBOOK_MINOR_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
+	LIBEBOOK_MICRO_VER=`echo $LIBEBOOK_VERSION | sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
+	AC_MSG_RESULT($LIBEBOOK_VERSION)
+	AC_DEFINE_UNQUOTED(LIBEBOOK_MAJOR_VER, $LIBEBOOK_MAJOR_VER, [libebook major version.])
+	AC_DEFINE_UNQUOTED(LIBEBOOK_MINOR_VER, $LIBEBOOK_MINOR_VER, [libebook minor version.])
+	AC_DEFINE_UNQUOTED(LIBEBOOK_MICRO_VER, $LIBEBOOK_MICRO_VER, [libebook micro version.])
 fi
 
 AM_CONDITIONAL(BUILD_GEVOLUTION, test "x$build_gevo" = "xyes")
--- a/plugins/gevolution/gevo-util.c	Sun May 23 22:17:38 2004 +0000
+++ b/plugins/gevolution/gevo-util.c	Sun May 23 22:43:37 2004 +0000
@@ -24,6 +24,8 @@
 
 #include <libebook/e-book.h>
 
+#include "gevolution.h"
+
 void
 gevo_add_buddy(GaimAccount *account, const char *group_name,
 			   const char *screenname, const char *alias)
@@ -129,15 +131,22 @@
 gboolean
 gevo_load_addressbook(EBook **book, GError **error)
 {
-	gboolean result;
+	gboolean result = FALSE;
 
 	g_return_val_if_fail(book != NULL, FALSE);
 
+#if EBOOK_CHECK_VERSION(0, 0, 93)
+	*book = e_book_new_system_addressbook(NULL);
+
+	if (book != NULL)
+		result = e_book_open(*book, FALSE, NULL);
+#else
 	*book = e_book_new();
 
-	result = e_book_load_local_addressbook (*book, error);
+	result = e_book_load_local_addressbook(*book, error);
+#endif
 
-	if (!result)
+	if (!result && *book != NULL)
 	{
 		g_object_unref(*book);
 		*book = NULL;
--- a/plugins/gevolution/gevolution.h	Sun May 23 22:17:38 2004 +0000
+++ b/plugins/gevolution/gevolution.h	Sun May 23 22:43:37 2004 +0000
@@ -21,6 +21,10 @@
 #ifndef _GEVOLUTION_H_
 #define _GEVOLUTION_H_
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <libebook/e-book.h>
 
 typedef struct
@@ -83,6 +87,12 @@
 
 } GevoAssociateBuddyDialog;
 
+#define EBOOK_CHECK_VERSION(major, minor, micro) \
+	(LIBEBOOK_MAJOR_VER > (major) || \
+	 (LIBEBOOK_MAJOR_VER == (major) && LIBEBOOK_MINOR_VER > (minor)) || \
+	 (LIBEBOOK_MAJOR_VER == (major) && LIBEBOOK_MINOR_VER == (minor) && \
+	  LIBEBOOK_MICRO_VER >= (micro)))
+
 void gevo_add_buddy_dialog_show(GaimAccount *account, const char *username,
 								const char *group, const char *alias);
 void gevo_add_buddy_dialog_add_person(GevoAddBuddyDialog *dialog,