[polari/wip/fmuellner/tracker: 9/15] chatView: Replace TpLogger with tracker
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari/wip/fmuellner/tracker: 9/15] chatView: Replace TpLogger with tracker
- Date: Sun, 24 Feb 2019 13:41:58 +0000 (UTC)
commit ba76914fce98de6b769b72db8df8de587d960714
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jan 8 16:10:17 2016 +0100
chatView: Replace TpLogger with tracker
src/chatView.js | 36 +++++++++++-------------------------
src/main.js | 1 -
2 files changed, 11 insertions(+), 26 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 9338644..dcf6077 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -1,12 +1,12 @@
/* exported ChatView */
const {
- Gdk, Gio, GLib, GObject, Gtk, Pango, PangoCairo, Polari,
- TelepathyGLib: Tp, TelepathyLogger: Tpl
+ Gdk, Gio, GLib, GObject, Gtk, Pango, PangoCairo, Polari, TelepathyGLib: Tp
} = imports.gi;
const Mainloop = imports.mainloop;
const { DropTargetIface } = imports.pasteManager;
+const { LogWalker } = imports.logger;
const { UserPopover } = imports.userList;
const { UserStatusMonitor } = imports.userTracker;
const Utils = imports.utils;
@@ -350,18 +350,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 LogWalker(this._room);
this._fetchingBacklog = true;
- this._logWalker.get_events_async(NUM_INITIAL_LOG_EVENTS,
- this._onLogEventsReady.bind(this));
+ this._logWalker.getEvents(NUM_INITIAL_LOG_EVENTS,
+ this._onLogEventsReady.bind(this));
this._autoscroll = true;
@@ -533,17 +526,14 @@ var ChatView = GObject.registerClass({
this._nickStatusChangedId = 0;
this._userTracker = null;
- 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();
}
@@ -553,17 +543,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();
@@ -714,7 +700,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)
@@ -723,8 +709,8 @@ var ChatView = GObject.registerClass({
this._fetchingBacklog = true;
this._showLoadingIndicator();
this._backlogTimeoutId = Mainloop.timeout_add(500, () => {
- this._logWalker.get_events_async(NUM_LOG_EVENTS,
- this._onLogEventsReady.bind(this));
+ this._logWalker.getEvents(NUM_LOG_EVENTS,
+ this._onLogEventsReady.bind(this));
this._backlogTimeoutId = 0;
return GLib.SOURCE_REMOVE;
});
diff --git a/src/main.js b/src/main.js
index b05e275..6c0900e 100755
--- a/src/main.js
+++ b/src/main.js
@@ -11,7 +11,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]