Skip to content
Snippets Groups Projects
Commit 4f7a0fa9 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

refactor: ChatStack: Add control methods

parent d982f6b8
No related branches found
No related tags found
No related merge requests found
......@@ -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:
......
......@@ -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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment