Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
172cf0d9
by Philipp Hörist at 2022-10-03T22:17:55+02:00
-
1ad0cafb
by Philipp Hörist at 2022-10-03T22:17:55+02:00
4 changed files:
Changes:
| ... | ... | @@ -32,7 +32,6 @@ |
| 32 | 32 | from gi.repository import GLib
|
| 33 | 33 | |
| 34 | 34 | DOMAIN = 'gajim'
|
| 35 | -direction_mark = '\u200E'
|
|
| 36 | 35 | _translation = gettext.NullTranslations()
|
| 37 | 36 | |
| 38 | 37 | |
| ... | ... | @@ -108,15 +107,6 @@ def get_short_lang_code(lang: Optional[str] = None) -> str: |
| 108 | 107 | return lang[:2]
|
| 109 | 108 | |
| 110 | 109 | |
| 111 | -def initialize_direction_mark() -> None:
|
|
| 112 | - from gi.repository import Gtk
|
|
| 113 | - |
|
| 114 | - global direction_mark # pylint: disable=global-statement
|
|
| 115 | - |
|
| 116 | - if Gtk.Widget.get_default_direction() == Gtk.TextDirection.RTL:
|
|
| 117 | - direction_mark = '\u200F'
|
|
| 118 | - |
|
| 119 | - |
|
| 120 | 110 | def paragraph_direction_mark(text: str) -> str:
|
| 121 | 111 | '''
|
| 122 | 112 | Determine paragraph writing direction according to
|
| ... | ... | @@ -28,7 +28,6 @@ |
| 28 | 28 | from packaging.version import Version as V
|
| 29 | 29 | |
| 30 | 30 | import gajim.gui
|
| 31 | -from gajim.common import i18n
|
|
| 32 | 31 | |
| 33 | 32 | |
| 34 | 33 | _MIN_NBXMPP_VER = '3.2.2'
|
| ... | ... | @@ -120,8 +119,6 @@ def _init_gtk() -> None: |
| 120 | 119 | from gajim.gui import exception
|
| 121 | 120 | exception.init()
|
| 122 | 121 | |
| 123 | - i18n.initialize_direction_mark()
|
|
| 124 | - |
|
| 125 | 122 | |
| 126 | 123 | def _run_app() -> None:
|
| 127 | 124 | from gajim.gui.application import GajimApplication
|
| ... | ... | @@ -544,6 +544,12 @@ def _add_unread(row: ChatListRow, event: MessageEventT) -> None: |
| 544 | 544 | row.reset_unread()
|
| 545 | 545 | return
|
| 546 | 546 | |
| 547 | + control = app.window.get_control()
|
|
| 548 | + if (app.window.is_active() and
|
|
| 549 | + row.is_selected() and
|
|
| 550 | + control.get_autoscroll()):
|
|
| 551 | + return
|
|
| 552 | + |
|
| 547 | 553 | row.add_unread(event.msgtxt)
|
| 548 | 554 | |
| 549 | 555 | def _on_message_received(self, event: MessageEventT) -> None:
|
| ... | ... | @@ -191,11 +191,6 @@ def __init__(self, |
| 191 | 191 | def is_pinned(self) -> bool:
|
| 192 | 192 | return self._pinned
|
| 193 | 193 | |
| 194 | - @property
|
|
| 195 | - def is_active(self) -> bool:
|
|
| 196 | - return (self.is_selected() and
|
|
| 197 | - self.get_toplevel().get_property('is-active'))
|
|
| 198 | - |
|
| 199 | 194 | @property
|
| 200 | 195 | def unread_count(self) -> int:
|
| 201 | 196 | if (self.contact.is_groupchat and not self.contact.can_notify() and
|
| ... | ... | @@ -309,12 +304,6 @@ def update_time(self) -> None: |
| 309 | 304 | get_uf_relative_time(self.timestamp))
|
| 310 | 305 | |
| 311 | 306 | def add_unread(self, text: str) -> None:
|
| 312 | - control = app.window.get_control()
|
|
| 313 | - if (self.is_active and
|
|
| 314 | - control.is_loaded(self.account, self.jid) and
|
|
| 315 | - control.get_autoscroll()):
|
|
| 316 | - return
|
|
| 317 | - |
|
| 318 | 307 | self._unread_count += 1
|
| 319 | 308 | self._update_unread()
|
| 320 | 309 | app.storage.cache.set_unread_count(
|