[polari/wip/fmuellner/tracker: 16/22] chatView: Replace TpLogger with tracker
- From: Gitlab Administrative User <gitlab src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/tracker: 16/22] chatView: Replace TpLogger with tracker
- Date: Wed, 1 Nov 2017 15:05:13 +0000 (UTC)
commit c3312d7a75008f9a861ad0d636ad05359a15fd18
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jan 8 16:10:17 2016 +0100
chatView: Replace TpLogger with tracker
src/chatView.js | 34 ++++++++++------------------------
src/main.js | 1 -
2 files changed, 10 insertions(+), 25 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 60adc8e..ee5f914 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -7,9 +7,9 @@ const Pango = imports.gi.Pango;
const PangoCairo = imports.gi.PangoCairo;
const Polari = imports.gi.Polari;
const Tp = imports.gi.TelepathyGLib;
-const Tpl = imports.gi.TelepathyLogger;
const Lang = imports.lang;
+const Logger = imports.logger;
const Mainloop = imports.mainloop;
const PasteManager = imports.pasteManager;
const Signals = imports.signals;
@@ -362,18 +362,11 @@ var ChatView = GObject.registerClass({
});
this._updateMaxNickChars(this._room.account.nickname.length);
- let isRoom = room.type == Tp.HandleType.ROOM;
- let target = new Tpl.Entity({ type: isRoom ? Tpl.EntityType.ROOM
- : Tpl.EntityType.CONTACT,
- identifier: room.channel_name });
- let logManager = Tpl.LogManager.dup_singleton();
- this._logWalker =
- logManager.walk_filtered_events(room.account, target,
- Tpl.EventTypeMask.TEXT, null);
+ this._logWalker = new Logger.LogWalker(this._room);
this._fetchingBacklog = true;
- this._logWalker.get_events_async(NUM_INITIAL_LOG_EVENTS,
- Lang.bind(this, this._onLogEventsReady));
+ this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
+ Lang.bind(this, this._onLogEventsReady));
this._autoscroll = true;
@@ -535,17 +528,14 @@ var ChatView = GObject.registerClass({
Mainloop.source_remove(this._backlogTimeoutId);
this._backlogTimeoutId = 0;
- this._logWalker.run_dispose();
this._logWalker = null;
}
- _onLogEventsReady(lw, res) {
+ _onLogEventsReady(events) {
this._hideLoadingIndicator();
this._fetchingBacklog = false;
- let [, events] = lw.get_events_finish(res);
- let messages = events.map(e => this._createMessage(e));
- this._pendingLogs = messages.concat(this._pendingLogs);
+ this._pendingLogs = events.concat(this._pendingLogs);
this._insertPendingLogs();
}
@@ -555,17 +545,13 @@ var ChatView = GObject.registerClass({
let msg = Polari.Message.new_from_tp_message(source);
msg.pendingId = valid ? id : undefined;
return msg;
- } else if (source instanceof Tpl.Event) {
- let msg = Polari.Message.new_from_tpl_event(source);
- msg.pendingId = undefined;
- return msg;
}
throw new Error('Cannot create message from source ' + source);
}
_getReadyLogs() {
- if (this._logWalker.is_end())
+ if (this._logWalker.isEnd())
return this._pendingLogs.splice(0);
let nick = this._pendingLogs[0].get_sender();
@@ -717,7 +703,7 @@ var ChatView = GObject.registerClass({
_fetchBacklog() {
if (this.vadjustment.value != 0 ||
- this._logWalker.is_end())
+ this._logWalker.isEnd())
return Gdk.EVENT_PROPAGATE;
if (this._fetchingBacklog)
@@ -726,8 +712,8 @@ var ChatView = GObject.registerClass({
this._fetchingBacklog = true;
this._showLoadingIndicator();
this._backlogTimeoutId = Mainloop.timeout_add(500, () => {
- this._logWalker.get_events_async(NUM_LOG_EVENTS,
- Lang.bind(this, this._onLogEventsReady));
+ this._logWalker.getEvents(NUM_LOG_EVENTS,
+ Lang.bind(this, this._onLogEventsReady));
this._backlogTimeoutId = 0;
return GLib.SOURCE_REMOVE;
});
diff --git a/src/main.js b/src/main.js
index d92dd16..bbe59e5 100755
--- a/src/main.js
+++ b/src/main.js
@@ -9,7 +9,6 @@ pkg.require({ 'GdkPixbuf': '2.0',
'Secret': '1',
'Soup': '2.4',
'TelepathyGLib': '0.12',
- 'TelepathyLogger': '0.2',
'Tracker': '2.0' });
pkg.requireSymbol('Gio', '2.0', 'Application.send_notification');
pkg.requireSymbol('GLib', '2.0', 'log_variant');
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]