Philipp Hörist pushed to branch mainwindow at gajim / gajim
Commits: c8099697 by lovetox at 2021-03-03T21:37:01+01:00 Fix Filter - - - - - 2 changed files: - gajim/gtk/chat_list.py - gajim/gtk/chat_list_stack.py Changes: ===================================== gajim/gtk/chat_list.py ===================================== @@ -66,7 +66,8 @@ def _update_timer(self): def _filter_func(self, row): if not self._current_filter_text: return True - return self._current_filter_text in row.jid + text = self._current_filter_text.lower() + return text in row.contact.name.lower() @staticmethod def _header_func(row, before): @@ -256,11 +257,11 @@ def __init__(self, workspace_id, account, jid, type_, pinned): self.conversations_label = ConversationsHeader() self.pinned_label = PinnedHeader() - self._contact = app.get_client(account).get_module('Contacts').get_contact(jid) - self._contact.connect('presence-update', self._on_presence_update) - self._contact.connect('chatstate-update', self._on_chatstate_update) - self._contact.connect('nickname-update', self._on_nickname_update) - self._contact.connect('avatar-update', self._on_avatar_update) + self.contact = app.get_client(account).get_module('Contacts').get_contact(jid) + self.contact.connect('presence-update', self._on_presence_update) + self.contact.connect('chatstate-update', self._on_chatstate_update) + self.contact.connect('nickname-update', self._on_nickname_update) + self.contact.connect('avatar-update', self._on_avatar_update) self._timestamp = None self._unread_count = 0 @@ -367,17 +368,17 @@ def _on_avatar_update(self, _contact, _signal_name): def update_avatar(self): scale = self.get_scale_factor() - surface = self._contact.get_avatar(AvatarSize.ROSTER, scale) + surface = self.contact.get_avatar(AvatarSize.ROSTER, scale) self._ui.avatar_image.set_from_surface(surface) def update_name(self): if self.type == 'pm': client = app.get_client(self.account) muc_name = get_groupchat_name(client, self.jid) - self._ui.name_label.set_text(f'{self._contact.name} ({muc_name})') + self._ui.name_label.set_text(f'{self.contact.name} ({muc_name})') return - self._ui.name_label.set_text(self._contact.name) + self._ui.name_label.set_text(self.contact.name) def _on_chatstate_update(self, contact, _signal_name): if contact.chatstate is None: ===================================== gajim/gtk/chat_list_stack.py ===================================== @@ -38,9 +38,12 @@ def __init__(self, main_window, ui, chat_stack): self._chat_stack = chat_stack self._chat_lists = {} + self._last_visible_child_name = 'default' + self.add_named(Gtk.Box(), 'default') self.show_all() + self.connect('notify::visible-child-name', self._on_visible_child_name) self._ui.search_entry.connect( 'search-changed', self._on_search_changed) @@ -53,6 +56,16 @@ def _on_window_active(self, window, _param): if chat is not None: chat.reset_unread() + def _on_visible_child_name(self, _stack, _param): + if self._last_visible_child_name == self.get_visible_child_name(): + return + + self._ui.search_entry.set_text('') + if self._last_visible_child_name != 'default': + child = self.get_child_by_name(self._last_visible_child_name) + child.set_filter_text('') + self._last_visible_child_name = self.get_visible_child_name() + def get_chatlist(self, workspace_id): return self._chat_lists[workspace_id] View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/c8099697ccd8136f738cf5136757b70605e889d7 -- View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/c8099697ccd8136f738cf5136757b70605e889d7 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