[polari/wip/fmuellner/tracker: 85/85] 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: 85/85] logManager: Try to start chatlog miner if not running
- Date: Fri, 21 Jul 2017 13:37:23 +0000 (UTC)
commit 1f49ead6323efce774c3dd7d97f0829a18d153bd
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
src/logManager.js | 35 +++++++++++++++++++++++++++++++++++
src/main.js | 3 ++-
2 files changed, 37 insertions(+), 1 deletions(-)
---
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);
diff --git a/src/main.js b/src/main.js
index 658ec75..946d944 100755
--- a/src/main.js
+++ b/src/main.js
@@ -9,7 +9,8 @@ pkg.require({ 'GdkPixbuf': '2.0',
'Secret': '1',
'Soup': '2.4',
'TelepathyGLib': '0.12',
- 'Tracker': '1.0' });
+ 'Tracker': '1.0',
+ 'TrackerControl', '1.0' });
pkg.requireSymbol('Gio', '2.0', 'Application.send_notification');
pkg.requireSymbol('GLib', '2.0', 'log_variant');
pkg.requireSymbol('Gspell', '1', 'Entry');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]