[folks] Make zeitgeist optional again



commit a832876c996e41d0872240a4399b1e0365436d60
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Oct 23 12:22:12 2012 -0400

    Make zeitgeist optional again
    
    This commit makes folks build without zeitgeist again.

 backends/telepathy/lib/Makefile.am            |    3 ++-
 backends/telepathy/lib/tpf-persona-store.vala |    9 +++++++++
 backends/telepathy/lib/tpf-persona.vala       |    4 ++++
 configure.ac                                  |   14 ++++++++++++--
 4 files changed, 27 insertions(+), 3 deletions(-)
---
diff --git a/backends/telepathy/lib/Makefile.am b/backends/telepathy/lib/Makefile.am
index 153ea7c..1101079 100644
--- a/backends/telepathy/lib/Makefile.am
+++ b/backends/telepathy/lib/Makefile.am
@@ -117,6 +117,7 @@ libfolks_telepathy_la_SOURCES = \
 libfolks_telepathy_la_VALAFLAGS = \
 	$(AM_VALAFLAGS) \
 	$(ERROR_VALAFLAGS) \
+	$(ZEITGEIST_VALAFLAGS) \
 	--vapidir=. \
 	--vapidir=$(top_srcdir)/folks \
 	--pkg folks \
@@ -126,7 +127,7 @@ libfolks_telepathy_la_VALAFLAGS = \
 	--pkg gio-2.0 \
 	--pkg gee-1.0 \
 	--pkg telepathy-glib \
-	--pkg zeitgeist-1.0 \
+	$(ZEITGEIST_PKG) \
 	--includedir folks \
 	--vapi folks-telepathy.vapi \
 	-H folks/folks-telepathy.h \
diff --git a/backends/telepathy/lib/tpf-persona-store.vala b/backends/telepathy/lib/tpf-persona-store.vala
index 786969a..1dfbfcf 100644
--- a/backends/telepathy/lib/tpf-persona-store.vala
+++ b/backends/telepathy/lib/tpf-persona-store.vala
@@ -24,7 +24,10 @@ using GLib;
 using Gee;
 using TelepathyGLib;
 using Folks;
+#if HAVE_ZEITGEIST
 using Zeitgeist;
+#endif
+
 extern const string G_LOG_DOMAIN;
 extern const string BACKEND_NAME;
 
@@ -97,8 +100,10 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
   private Account _account;
 
+#if HAVE_ZEITGEIST
   private Zeitgeist.Log? _log= null;
   private Zeitgeist.Monitor? _monitor = null;
+#endif
 
   /**
    * The Telepathy account this store is based upon.
@@ -1176,7 +1181,9 @@ public class Tpf.PersonaStore : Folks.PersonaStore
           new GLib.GenericArray<TelepathyGLib.Contact> ());
 
       this._got_initial_members = true;
+#if HAVE_ZEITGEIST
       this._populate_counters.begin ();
+#endif
       this._notify_if_is_quiescent ();
     }
 
@@ -1686,6 +1693,7 @@ public class Tpf.PersonaStore : Folks.PersonaStore
       return store;
     }
 
+#if HAVE_ZEITGEIST
   private string? _get_iid_from_event_metadata (string? uri)
     {
       /* Format a proper id represting a persona in the store.
@@ -1796,4 +1804,5 @@ public class Tpf.PersonaStore : Folks.PersonaStore
 
       this._notify_if_is_quiescent ();
     }
+#endif
 }
diff --git a/backends/telepathy/lib/tpf-persona.vala b/backends/telepathy/lib/tpf-persona.vala
index a3e6449..d304752 100644
--- a/backends/telepathy/lib/tpf-persona.vala
+++ b/backends/telepathy/lib/tpf-persona.vala
@@ -22,7 +22,9 @@ using Gee;
 using GLib;
 using TelepathyGLib;
 using Folks;
+#if HAVE_ZEITGEIST
 using Zeitgeist;
+#endif
 
 /**
  * A persona subclass which represents a single instant messaging contact from
@@ -1374,6 +1376,7 @@ public class Tpf.Persona : Folks.Persona,
       return store._ensure_persona_for_contact (contact);
     }
 
+#if HAVE_ZEITGEIST
   internal void _increase_counter (string id, string interaction_type, Event event)
     {
       var timestamp = (uint) (event.get_timestamp () / 1000);
@@ -1420,4 +1423,5 @@ public class Tpf.Persona : Folks.Persona,
       this._last_call_interaction_datetime = null;
       this._last_im_interaction_datetime = null;
     }
+#endif
 }
diff --git a/configure.ac b/configure.ac
index 9c460c3..adaee79 100644
--- a/configure.ac
+++ b/configure.ac
@@ -206,7 +206,13 @@ Gee 0.6.x)])
 TP_GLIB_REQUIRED=0.19.0
 AS_IF([test x$enable_telepathy_backend = xyes], [
         PKG_CHECK_MODULES([TP_GLIB], [telepathy-glib >= $TP_GLIB_REQUIRED])
-        PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED])
+        PKG_CHECK_MODULES([ZEITGEIST], [zeitgeist-1.0 >= $ZEITGEIST_REQUIRED],
+	                   have_zeitgeist="yes",have_zeitgeist="no")])
+AS_IF([test "x$have_zeitgeist" == "xyes"], [
+   ZEITGEIST_VALAFLAGS="-DHAVE_ZEITGEIST"
+   AC_SUBST([ZEITGEIST_VALAFLAGS])
+   ZEITGEIST_PKG="-pkg zeitgeist"
+   AC_SUBST([ZEITGEIST_PKG])
 ])
 
 # Ignore post 0.20 deprecations
@@ -305,7 +311,10 @@ AS_IF([test "x$enable_vala" = "xyes"], [
                              gee-1.0])
 
         AS_IF([test x$enable_telepathy_backend = xyes], [
-          VALA_CHECK_PACKAGES([telepathy-glib zeitgeist-1.0])
+          VALA_CHECK_PACKAGES([telepathy-glib])
+	  AS_IF([test "x$have_zeitgeist" == "xyes"], [
+	      VALA_CHECK_PACKAGES([zeitgeist-1.0])
+	  ])
         ])
 
         AS_IF([test x$enable_tracker_backend = xyes], [
@@ -682,5 +691,6 @@ Configure summary:
         Libsocialweb backend........:  ${have_libsocialweb_backend}
         E-D-S backend...............:  ${enable_eds_backend}
         Ofono backend...............:  ${enable_ofono_backend}
+        Zeitgeist support...........:  ${have_zeitgeist}
         Build tests.................:  ${enable_tests}
 "



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