Philipp Hörist pushed to branch master at gajim / gajim
Commits: 172cf0d9 by Philipp Hörist at 2022-10-03T22:17:55+02:00 refactor: ChatListRow: Move active check into ChatList - - - - - 1ad0cafb by Philipp Hörist at 2022-10-03T22:17:55+02:00 refactor: Remove unused code - - - - - 4 changed files: - gajim/common/i18n.py - gajim/gajim.py - gajim/gtk/chat_list.py - gajim/gtk/chat_list_row.py Changes: ===================================== gajim/common/i18n.py ===================================== @@ -32,7 +32,6 @@ from gi.repository import GLib DOMAIN = 'gajim' -direction_mark = '\u200E' _translation = gettext.NullTranslations() @@ -108,15 +107,6 @@ def get_short_lang_code(lang: Optional[str] = None) -> str: return lang[:2] -def initialize_direction_mark() -> None: - from gi.repository import Gtk - - global direction_mark # pylint: disable=global-statement - - if Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL: - direction_mark = '\u200F' - - def paragraph_direction_mark(text: str) -> str: ''' Determine paragraph writing direction according to ===================================== gajim/gajim.py ===================================== @@ -28,7 +28,6 @@ from packaging.version import Version as V import gajim.gui -from gajim.common import i18n _MIN_NBXMPP_VER = '3.2.2' @@ -120,8 +119,6 @@ def _init_gtk() -> None: from gajim.gui import exception exception.init() - i18n.initialize_direction_mark() - def _run_app() -> None: from gajim.gui.application import GajimApplication ===================================== gajim/gtk/chat_list.py ===================================== @@ -544,6 +544,12 @@ def _add_unread(row: ChatListRow, event: MessageEventT) -> None: 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: ===================================== gajim/gtk/chat_list_row.py ===================================== @@ -191,11 +191,6 @@ def __init__(self, def is_pinned(self) -> bool: 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 @@ -309,12 +304,6 @@ def update_time(self) -> None: 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( View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/4f57adce1666a1599b420c02ce87eb431f6971a9...1ad0cafb052dfb7741bdd69ccd98feed4fc0e393 -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/4f57adce1666a1599b420c02ce87eb431f6971a9...1ad0cafb052dfb7741bdd69ccd98feed4fc0e393 You're receiving this email because of your account on dev.gajim.org.
_______________________________________________ Commits mailing list Commits@gajim.org https://lists.gajim.org/cgi-bin/listinfo/commits