[brasero/wip/carlosg/tracker3: 24/24] Support Tracker 3.0




commit ddf25f215768cbc3c577960caef4dce1d8b16969
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Dec 24 13:22:43 2020 +0100

    Support Tracker 3.0
    
    Add the compile-time checks, and add the minimal code catering for
    the API changes. In 3.0 connections are no longer singletons.

 configure.ac                 | 6 +++++-
 src/brasero-search-tracker.c | 8 ++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)
---
diff --git a/configure.ac b/configure.ac
index d0c7a870..96afc551 100644
--- a/configure.ac
+++ b/configure.ac
@@ -388,7 +388,7 @@ AC_ARG_ENABLE(search,
 if test x"$enable_search" != "xno"; then
         # Try to figure out the tracker API version to use
         tracker_api="0.10"
-        m4_foreach([VERSION], [[0.10], [0.12], [0.14], [0.16], [0.18], [1.0], [2.0]],
+        m4_foreach([VERSION], [[0.10], [0.12], [0.14], [0.16], [0.18], [1.0], [2.0], [3.0]],
                               [PKG_CHECK_EXISTS([tracker-sparql-VERSION >= $TRACKER_REQUIRED],
                                                 [tracker_api="VERSION"])
                               ])
@@ -408,6 +408,10 @@ if test x"$enable_search" = "xyes"; then
        AC_SUBST(BRASERO_SEARCH_LIBS)
        build_tracker="yes"
        build_search="yes"
+
+       if test x"$tracker_api" = x"3.0"; then
+               AC_DEFINE(HAVE_TRACKER3, 1, [define if tracker3 is available])
+       fi
 else
        build_search="no"
 fi
diff --git a/src/brasero-search-tracker.c b/src/brasero-search-tracker.c
index 9aa06289..40c5f1ac 100644
--- a/src/brasero-search-tracker.c
+++ b/src/brasero-search-tracker.c
@@ -17,6 +17,8 @@
  * with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 
 #include <libtracker-sparql/tracker-sparql.h>
@@ -444,7 +446,13 @@ brasero_search_tracker_init (BraseroSearchTracker *object)
 
        priv = BRASERO_SEARCH_TRACKER_PRIVATE (object);
        priv->cancellable = g_cancellable_new ();
+
+#ifdef HAVE_TRACKER3
+       priv->connection = tracker_sparql_connection_bus_new ("org.freedesktop.Tracker3.Miner.Files",
+                                                             NULL, NULL, &error);
+#else
        priv->connection = tracker_sparql_connection_get (priv->cancellable, &error);
+#endif
 
        if (error) {
                g_warning ("Could not establish a connection to Tracker: %s", error->message);


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