[tracker/external-crawler: 28/37] libtracker-miner: Make it possible to start the miner via DBus



commit 2b08d09252a1cc13a90c2d98574513ca9593f882
Author: Martyn Russell <martyn lanedo com>
Date:   Thu Jun 12 19:08:03 2014 +0100

    libtracker-miner: Make it possible to start the miner via DBus

 data/dbus/tracker-miner.xml                 |    3 +++
 src/libtracker-miner/tracker-miner-object.c |   21 +++++++++++++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/data/dbus/tracker-miner.xml b/data/dbus/tracker-miner.xml
index 77f5469..6256c12 100644
--- a/data/dbus/tracker-miner.xml
+++ b/data/dbus/tracker-miner.xml
@@ -3,6 +3,9 @@
 <node name="/">
   <interface name="org.freedesktop.Tracker1.Miner">
     <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="_tracker_miner_dbus"/>
+    <method name="Start">
+      <annotation name="org.freedesktop.DBus.GLib.Async"  value="true"/>
+    </method>
     <method name="GetStatus">
       <annotation name="org.freedesktop.DBus.GLib.Async" value="true"/>
       <arg type="s" name="status" direction="out" />
diff --git a/src/libtracker-miner/tracker-miner-object.c b/src/libtracker-miner/tracker-miner-object.c
index 61f15ed..def83d5 100644
--- a/src/libtracker-miner/tracker-miner-object.c
+++ b/src/libtracker-miner/tracker-miner-object.c
@@ -69,6 +69,8 @@
 static const gchar introspection_xml[] =
   "<node>"
   "  <interface name='org.freedesktop.Tracker1.Miner'>"
+  "    <method name='Start'>"
+  "    </method>"
   "    <method name='GetStatus'>"
   "      <arg type='s' name='status' direction='out' />"
   "    </method>"
@@ -1178,6 +1180,23 @@ miner_finalize (GObject *object)
 }
 
 static void
+handle_method_call_start (TrackerMiner          *miner,
+                          GDBusMethodInvocation *invocation,
+                          GVariant              *parameters)
+{
+       TrackerDBusRequest *request;
+
+       request = tracker_g_dbus_request_begin (invocation,
+                                               "%s",
+                                               __PRETTY_FUNCTION__);
+
+       tracker_miner_start (miner);
+
+       tracker_dbus_request_end (request, NULL);
+       g_dbus_method_invocation_return_value (invocation, NULL);
+}
+
+static void
 handle_method_call_ignore_next_update (TrackerMiner          *miner,
                                        GDBusMethodInvocation *invocation,
                                        GVariant              *parameters)
@@ -1405,6 +1424,8 @@ handle_method_call (GDBusConnection       *connection,
 
        if (g_strcmp0 (method_name, "IgnoreNextUpdate") == 0) {
                handle_method_call_ignore_next_update (miner, invocation, parameters);
+       } else if (g_strcmp0 (method_name, "Start") == 0) {
+               handle_method_call_start (miner, invocation, parameters);
        } else if (g_strcmp0 (method_name, "Resume") == 0) {
                handle_method_call_resume (miner, invocation, parameters);
        } else if (g_strcmp0 (method_name, "Pause") == 0) {


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