Philipp Hörist pushed to branch master at gajim / gajim
Commits: 17d05ee0 by Philipp Hörist at 2022-10-03T20:11:54+02:00 refactor: ChatPage: Check selected chat instead of active
- - - - - ab066084 by Philipp Hörist at 2022-10-03T20:11:54+02:00 refactor: Main: Simplify active check
- - - - -
3 changed files:
- gajim/gtk/chat_list_stack.py - gajim/gtk/chat_page.py - gajim/gtk/main.py
Changes:
===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -133,13 +133,11 @@ def get_current_chat_list(self) -> Optional[ChatList]:
return self._chat_lists[workspace_id]
- def is_chat_active(self, account: str, jid: JID) -> bool: + def is_chat_selected(self, account: str, jid: JID) -> bool: chat = self.get_selected_chat() if chat is None: return False - if chat.account != account or chat.jid != jid: - return False - return chat.is_active + return chat.account == account and chat.jid == jid
def _on_filter_changed(self, _filter: ChatFilter, name: str) -> None: chat_list = cast(ChatList, self.get_visible_child())
===================================== gajim/gtk/chat_page.py ===================================== @@ -273,8 +273,8 @@ def load_workspace_chats(self, workspace_id: str) -> None: pinned=open_chat['pinned'], position=open_chat['position'])
- def is_chat_active(self, account: str, jid: JID) -> bool: - return self._chat_list_stack.is_chat_active(account, jid) + def is_chat_selected(self, account: str, jid: JID) -> bool: + return self._chat_list_stack.is_chat_selected(account, jid)
def restore_chat(self) -> None: if not self._closed_chat_memory:
===================================== gajim/gtk/main.py ===================================== @@ -563,9 +563,9 @@ def get_active_workspace(self) -> Optional[str]: return self._workspace_side_bar.get_active_workspace()
def is_chat_active(self, account: str, jid: JID) -> bool: - if not self.get_property('has-toplevel-focus'): + if not self.has_toplevel_focus(): return False - return self._chat_page.is_chat_active(account, jid) + return self._chat_page.is_chat_selected(account, jid)
def highlight_dnd_targets(self, drag_row: Any, highlight: bool) -> None: css_class = 'dnd-target' @@ -883,8 +883,8 @@ def _on_window_active(self, window: Gtk.ApplicationWindow, _param: Any ) -> None: - is_active = window.get_property('is-active') - if not is_active: + + if not window.is_active(): return
set_urgency_hint(self, False)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/25af863a278059c5abd02a0a67fb2ed4...