Philipp Hörist pushed to branch master at gajim / gajim
Commits: 4f7a0fa9 by lovetox at 2022-06-23T21:55:00+02:00 refactor: ChatStack: Add control methods
- - - - -
2 changed files:
- gajim/gtk/chat_page.py - gajim/gtk/chat_stack.py
Changes:
===================================== gajim/gtk/chat_page.py ===================================== @@ -151,12 +151,12 @@ def _on_chat_selected(self, account: str, jid: JID) -> None:
- self._control_stack.show_chat(account, jid) + self._chat_stack.show_chat(account, jid) self._search_view.set_context(account, jid) self.emit('chat-selected', workspace_id, account, jid)
def _on_chat_unselected(self, _chat_list_stack: ChatListStack) -> None: - self._control_stack.clear() + self._chat_stack.clear() self._search_view.set_context(None, None)
def _on_search_history(self, @@ -185,7 +185,7 @@ def _on_chat_list_changed(self, self._ui.search_entry.set_text('')
def process_event(self, event: ApplicationEvent): - self._control_stack.process_event(event) + self._chat_stack.process_event(event) self._chat_list_stack.process_event(event)
def add_chat_list(self, workspace_id: str) -> None:
===================================== gajim/gtk/chat_stack.py ===================================== @@ -12,9 +12,12 @@ # You should have received a copy of the GNU General Public License # along with Gajim. If not, see http://www.gnu.org/licenses/.
+from typing import Any + import logging
from gi.repository import Gtk +from nbxmpp.protocol import JID
from .control_stack import ControlStack from .util import EventHelper @@ -32,7 +35,7 @@ def __init__(self):
self._control_stack = ControlStack()
- box = Gtk.Box() + box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) box.add(self._control_stack)
self.add_named(box, 'controls') @@ -41,3 +44,12 @@ def __init__(self):
def get_control_stack(self) -> ControlStack: return self._control_stack + + def show_chat(self, account: str, jid: JID) -> None: + self._control_stack.show_chat(account, jid) + + def clear(self) -> None: + self._control_stack.clear() + + def process_event(self, event: Any) -> None: + self._control_stack.process_event(event)
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/4f7a0fa94fac91439dedcb3eeeebdbca8...