[gnome-applets/tracker-3: 2/2] tracker-search-bar: port to tracker 3




commit d0791f15f17efe47ea446b4e6f8ff968cc9eb66f
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Tue Dec 29 19:13:27 2020 +0200

    tracker-search-bar: port to tracker 3
    
    https://gitlab.gnome.org/GNOME/gnome-applets/-/issues/18

 configure.ac                                        | 21 +++++++++++++++------
 .../tracker-search-bar/tracker-results-window.c     |  9 +++++++++
 2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0a32dca62..fffc819f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,11 +175,20 @@ PKG_CHECK_MODULES(XML2, libxml-2.0 >= $LIBXML_REQUIRED)
 PKG_CHECK_MODULES(LIBGWEATHER, gweather-3.0 >= $GWEATHER_REQUIRED)
 
  dnl -- check for tracker-sparql (required for tracker-search-bar) ------------
-TRACKER_SEARCH_BAR_REQUIRED="tracker-sparql-2.0"
-
-PKG_CHECK_MODULES(TRACKER_SEARCH_BAR, [$TRACKER_SEARCH_BAR_REQUIRED],
-                  [have_tracker_search_bar=yes],
-                  [have_tracker_search_bar=no])
+PKG_CHECK_MODULES([TRACKER_SEARCH_BAR], [
+  tracker-sparql-3.0
+], [
+  AC_DEFINE([HAVE_TRACKER3], [1], [Define to 1 if tracker3 is available])
+  have_tracker_search_bar=yes
+], [
+  PKG_CHECK_MODULES([TRACKER_SEARCH_BAR], [
+    tracker-sparql-2.0
+  ], [
+    have_tracker_search_bar=yes
+  ], [
+    have_tracker_search_bar=no
+  ])
+])
 
 dnl -- check for GSettings (required for gweather applet)
 GLIB_GSETTINGS
@@ -286,7 +295,7 @@ AC_ARG_ENABLE([tracker-search-bar],
 
 if test "x$enable_tracker_search_bar" = "xyes" ; then
    if test "x$have_tracker_search_bar" != "xyes"; then
-      AC_MSG_ERROR([Couldn't find tracker-search-bar dependencies ($TRACKER_SEARCH_BAR_REQUIRED).])
+      AC_MSG_ERROR([Couldn't find tracker-search-bar dependencies.])
    fi
 else
    if test "x$enable_tracker_search_bar" = "xno"; then
diff --git a/gnome-applets/tracker-search-bar/tracker-results-window.c 
b/gnome-applets/tracker-search-bar/tracker-results-window.c
index 0aaf11e8f..17b685763 100644
--- a/gnome-applets/tracker-search-bar/tracker-results-window.c
+++ b/gnome-applets/tracker-search-bar/tracker-results-window.c
@@ -359,7 +359,16 @@ tracker_results_window_init (TrackerResultsWindow *self)
        GError *error = NULL;
 
        self->cancellable = g_cancellable_new ();
+
+#ifdef HAVE_TRACKER3
+       self->connection = tracker_sparql_connection_bus_new ("org.freedesktop.Tracker3.Miner.Files",
+                                                             NULL,
+                                                             NULL,
+                                                             &error);
+#else
        self->connection = tracker_sparql_connection_get (self->cancellable, &error);
+#endif
+
        if (error != NULL) {
                g_warning ("Cannot connect to tracker: %s\n", error->message);
                g_error_free (error);


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