[polari/wip/fmuellner/tracker: 88/88] logManager: Try to start chatlog miner if not running
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/tracker: 88/88] logManager: Try to start chatlog miner if not running
- Date: Thu, 9 Mar 2017 22:21:14 +0000 (UTC)
commit b6de9fa47d5b77bc6b0b0a5c116a170cd6d314fb
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 28 02:41:31 2016 +0200
logManager: Try to start chatlog miner if not running
configure.ac | 1 +
src/logManager.js | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index c9665be..7707f77 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,7 @@ AX_CHECK_GIRS_GJS([Secret], [1])
AX_CHECK_GIRS_GJS([Soup], [2.4])
AX_CHECK_GIRS_GJS([TelepathyGLib], [0.12])
AX_CHECK_GIRS_GJS([Tracker], [1.0])
+AX_CHECK_GIRS_GJS([TrackerControl], [1.0])
AC_PROG_LN_S
diff --git a/src/logManager.js b/src/logManager.js
index 6ceaa2f..9ccf148 100644
--- a/src/logManager.js
+++ b/src/logManager.js
@@ -1,8 +1,12 @@
const Gio = imports.gi.Gio;
const Lang = imports.lang;
const Tracker = imports.gi.Tracker;
+const TrackerControl = imports.gi.TrackerControl;
const Tp = imports.gi.TelepathyGLib;
+const CHATLOG_MINER_NAME = Tracker.DBUS_SERVICE + '.Miner.Chatlog';
+const CHATLOG_MINER_PATH = '/' + CHATLOG_MINER_NAME.replace('.', '/', 'g');
+
let _logManager = null;
function getDefault() {
@@ -195,9 +199,40 @@ const _LogManager = new Lang.Class({
Name: 'LogManager',
_init: function() {
+ this._ensureChatlogMiner();
this._connection = Tracker.SparqlConnection.get(null);
},
+ _ensureChatlogMiner: function() {
+ let running = false;
+ try {
+ let manager = TrackerControl.MinerManager.new_full(false);
+ [running,] = manager.get_status(CHATLOG_MINER_NAME);
+ } catch(e) {
+ debug('Unable to create MinerManager: ' + e.message);
+ }
+
+ if (running) {
+ debug('Detected running chatlog miner.');
+ return;
+ }
+
+ let flags = Gio.DBusProxyFlags.DO_NOT_LOAD_PROPERTIES |
+ Gio.DBusProxyFlags.DO_NOT_CONNECT_SIGNALS;
+ Gio.DBusProxy.new_for_bus(Gio.BusType.SESSION, flags, null,
+ CHATLOG_MINER_NAME, CHATLOG_MINER_PATH,
+ Tracker.DBUS_SERVICE + '.Miner',
+ null, (o, res) => {
+ let miner = null;
+ try {
+ miner = Gio.DBusProxy.new_for_bus_finish(res);
+ debug('Started chatlog miner.');
+ } catch(e) {
+ log('Failed to start chatlog miner: ' + e.message);
+ }
+ });
+ },
+
query: function(sparql, cancellable, callback) {
let query = new GenericQuery(this._connection);
query.run(sparql, cancellable, callback);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]