[tracker/tracker-1.4] tracker-preferences: Use the new command line tool



commit 7b225569d021b0fd1143b30a0a1ad3f63a5cca97
Author: Carlos Garnacho <carlosg gnome org>
Date:   Sun Jul 5 20:11:32 2015 +0200

    tracker-preferences: Use the new command line tool
    
    We resort to the tracker CLI for restart/reindex, the calls have
    changed to use Posix.system() as there's some operations that are
    now mutually exclusive in the CLI tool (eg. reset and start daemons)
    and still need to be performed in a single step here.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=748677

 src/tracker-preferences/Makefile.am              |    2 +-
 src/tracker-preferences/tracker-preferences.vala |   33 ++--------------------
 2 files changed, 4 insertions(+), 31 deletions(-)
---
diff --git a/src/tracker-preferences/Makefile.am b/src/tracker-preferences/Makefile.am
index 97fb4f2..09b32a6 100644
--- a/src/tracker-preferences/Makefile.am
+++ b/src/tracker-preferences/Makefile.am
@@ -11,7 +11,7 @@ appdata_DATA =  tracker-preferences.appdata.xml
 pkgdata_DATA = tracker-preferences.ui
 
 AM_VALAFLAGS =                                         \
-       --pkg gtk+-3.0 --pkg gmodule-2.0               \
+       --pkg gtk+-3.0 --pkg gmodule-2.0 --pkg posix   \
        $(BUILD_VALAFLAGS)                             \
        config.vapi                                    \
        tracker-config.vapi
diff --git a/src/tracker-preferences/tracker-preferences.vala 
b/src/tracker-preferences/tracker-preferences.vala
index 6759734..d851163 100644
--- a/src/tracker-preferences/tracker-preferences.vala
+++ b/src/tracker-preferences/tracker-preferences.vala
@@ -21,6 +21,7 @@
 using Gtk;
 using GLib;
 using Tracker;
+using Posix;
 
 [CCode (cname = "TRACKER_UI_DIR")]
 extern static const string UIDIR;
@@ -244,39 +245,11 @@ public class Tracker.Preferences {
        }
 
        void reindex () {
-               string output, errors;
-               int status;
-
-               try {
-                       Process.spawn_sync (null, /* working dir */
-                                           {"tracker-control", "--hard-reset", "--start" },
-                                           null, /* env */
-                                           SpawnFlags.SEARCH_PATH,
-                                           null,
-                                           out output,
-                                           out errors,
-                                           out status);
-               } catch (GLib.Error e) {
-                       stderr.printf ("Could not reindex: %s", e.message);
-               }
+               Posix.system ("tracker reset --hard && tracker daemon --start");
        }
 
        void restart () {
-               string output, errors;
-               int status;
-
-               try {
-                       Process.spawn_sync (null, /* working dir */
-                                           {"tracker-control", "--terminate=miners", "--terminate=store", 
"--start" },
-                                           null, /* env */
-                                           SpawnFlags.SEARCH_PATH,
-                                           null,
-                                           out output,
-                                           out errors,
-                                           out status);
-               } catch (GLib.Error e) {
-                       stderr.printf ("Could not restart: %s", e.message);
-               }
+               Posix.system ("tracker daemon --terminate=miners --terminate=store && tracker daemon 
--start");
        }
 
        // This function is used to fix up the parameter ordering for callbacks


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