Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2022-10-03 22:43:38 +0300
committerPhilipp Hörist <philipp@hoerist.com>2022-10-03 23:17:55 +0300
commit172cf0d92bacf7066321f006b31bc0e268507dcc (patch)
treefececf7384f7adceb4ff8e2aca41ce6f26b96c0b
parent4f57adce1666a1599b420c02ce87eb431f6971a9 (diff)
refactor: ChatListRow: Move active check into ChatList
-rw-r--r--gajim/gtk/chat_list.py6
-rw-r--r--gajim/gtk/chat_list_row.py11
2 files changed, 6 insertions, 11 deletions
diff --git a/gajim/gtk/chat_list.py b/gajim/gtk/chat_list.py
index 1d4c07be7..4cb9479cc 100644
--- a/gajim/gtk/chat_list.py
+++ b/gajim/gtk/chat_list.py
@@ -544,6 +544,12 @@ class ChatList(Gtk.ListBox, EventHelper):
row.reset_unread()
return
+ control = app.window.get_control()
+ if (app.window.is_active() and
+ row.is_selected() and
+ control.get_autoscroll()):
+ return
+
row.add_unread(event.msgtxt)
def _on_message_received(self, event: MessageEventT) -> None:
diff --git a/gajim/gtk/chat_list_row.py b/gajim/gtk/chat_list_row.py
index 6783c3557..65743f7d5 100644
--- a/gajim/gtk/chat_list_row.py
+++ b/gajim/gtk/chat_list_row.py
@@ -192,11 +192,6 @@ class ChatListRow(Gtk.ListBoxRow):
return self._pinned
@property
- def is_active(self) -> bool:
- return (self.is_selected() and
- self.get_toplevel().get_property('is-active'))
-
- @property
def unread_count(self) -> int:
if (self.contact.is_groupchat and not self.contact.can_notify() and
not self._needs_muc_highlight):
@@ -309,12 +304,6 @@ class ChatListRow(Gtk.ListBoxRow):
get_uf_relative_time(self.timestamp))
def add_unread(self, text: str) -> None:
- control = app.window.get_control()
- if (self.is_active and
- control.is_loaded(self.account, self.jid) and
- control.get_autoscroll()):
- return
-
self._unread_count += 1
self._update_unread()
app.storage.cache.set_unread_count(