[evolution-data-server/evolution-data-server-3-12] Do not add GTasks source when the GTasks backend is not built



commit 244347df26e4d0ea11e5590bab6461b7acd87067
Author: Milan Crha <mcrha redhat com>
Date:   Mon Sep 1 11:14:14 2014 +0200

    Do not add GTasks source when the GTasks backend is not built
    
    It was causing an error "Unable to connect to 'Tasks': No backend
    factory for hash key 'gtasks:VTODO'" when this source was selected
    in UI, because the source was added unconditionally, while
    the backend itself is built with libgdata 0.15.1+ only.

 calendar/backends/Makefile.am                  |    2 +-
 modules/google-backend/Makefile.am             |    2 ++
 modules/google-backend/module-google-backend.c |   15 +++++++++++++++
 3 files changed, 18 insertions(+), 1 deletions(-)
---
diff --git a/calendar/backends/Makefile.am b/calendar/backends/Makefile.am
index 672c417..81d2f52 100644
--- a/calendar/backends/Makefile.am
+++ b/calendar/backends/Makefile.am
@@ -1,4 +1,4 @@
-if  HAVE_GDATA_0_15_1
+if HAVE_GDATA_0_15_1
 GTASKS_SUBDIR = gtasks
 else
 GTASKS_SUBDIR =
diff --git a/modules/google-backend/Makefile.am b/modules/google-backend/Makefile.am
index 9a046dc..3063f4e 100644
--- a/modules/google-backend/Makefile.am
+++ b/modules/google-backend/Makefile.am
@@ -8,6 +8,7 @@ module_google_backend_la_CPPFLAGS = \
        -DG_LOG_DOMAIN=\"module-google-backend\" \
        $(E_BACKEND_CFLAGS) \
        $(E_DATA_SERVER_CFLAGS) \
+       $(GDATA_CFLAGS) \
        $(NULL)
 
 module_google_backend_la_SOURCES = \
@@ -20,6 +21,7 @@ module_google_backend_la_LIBADD = \
        $(top_builddir)/camel/libcamel-1.2.la \
        $(E_BACKEND_LIBS) \
        $(E_DATA_SERVER_LIBS) \
+       $(GDATA_LIBS) \
        $(NULL)
 
 module_google_backend_la_LDFLAGS = \
diff --git a/modules/google-backend/module-google-backend.c b/modules/google-backend/module-google-backend.c
index 4f2a47f..dc755a4 100644
--- a/modules/google-backend/module-google-backend.c
+++ b/modules/google-backend/module-google-backend.c
@@ -20,6 +20,16 @@
 
 #include <libebackend/libebackend.h>
 
+#ifdef HAVE_GOOGLE
+#include <gdata/gdata.h>
+#endif
+
+/* This macro was introduced in libgdata 0.11,
+ * but we currently only require libgdata 0.10. */
+#ifndef GDATA_CHECK_VERSION
+#define GDATA_CHECK_VERSION(major,minor,micro) 0
+#endif
+
 /* Standard GObject macros */
 #define E_TYPE_GOOGLE_BACKEND \
        (e_google_backend_get_type ())
@@ -245,6 +255,7 @@ google_backend_add_calendar (ECollectionBackend *backend)
        g_object_unref (source);
 }
 
+#if GDATA_CHECK_VERSION(0,15,1)
 static void
 google_backend_add_tasks (ECollectionBackend *backend)
 {
@@ -301,6 +312,7 @@ google_backend_add_tasks (ECollectionBackend *backend)
 
        g_object_unref (source);
 }
+#endif /* GDATA_CHECK_VERSION(0,15,1) */
 
 static void
 google_backend_add_contacts (ECollectionBackend *backend)
@@ -373,8 +385,11 @@ google_backend_populate (ECollectionBackend *backend)
 
        if (!have_calendar)
                google_backend_add_calendar (backend);
+
+#if GDATA_CHECK_VERSION(0,15,1)
        if (!have_tasks)
                google_backend_add_tasks (backend);
+#endif
 
        list = e_collection_backend_list_contacts_sources (backend);
        if (list == NULL)


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