[polari/wip/fmuellner/window-experiments: 6/32] chatView: Remove pending marks on channel changes



commit 7c6ad77d55d37716099504b4670ff0772670c406
Author: Florian Müllner <fmuellner gnome org>
Date:   Fri Jun 10 22:42:00 2016 +0200

    chatView: Remove pending marks on channel changes

 src/chatView.js |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/chatView.js b/src/chatView.js
index 1f8bf4a..975428d 100644
--- a/src/chatView.js
+++ b/src/chatView.js
@@ -709,6 +709,11 @@ const ChatView = new Lang.Class({
 
     _pendingMessageRemoved: function(channel, message) {
         let [id,] = message.get_pending_message_id();
+        this._removePendingMark(id);
+        this._app.withdraw_notification('pending-message-' + id);
+    },
+
+    _removePendingMark: function(id) {
         let mark = this._pending.get(id);
         if (!mark)
             return;
@@ -716,7 +721,6 @@ const ChatView = new Lang.Class({
         if (this._view.buffer.get_iter_at_mark(mark).is_end())
             this._autoscroll = true;
         this._view.buffer.delete_mark(mark);
-        this._app.withdraw_notification('pending-message-' + id);
         this._pending.delete(id);
     },
 
@@ -893,6 +897,11 @@ const ChatView = new Lang.Class({
         if (this._channel == this._room.channel)
             return;
 
+        // Pending IDs are invalidated by channel changes, so
+        // remove marks to not get stuck on highlighted messages
+        for (let id of this._pending.entries())
+            this._removePendingMark(id);
+
         if (this._channel) {
             for (let i = 0; i < this._channelSignals.length; i++)
                 this._channel.disconnect(this._channelSignals[i]);


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