Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwurstsalat <mailtrash@posteo.de>2023-02-23 22:02:11 +0300
committerwurstsalat <mailtrash@posteo.de>2023-06-15 22:48:09 +0300
commit0180cae59a6eedd395e7cc25c9a28d5adcdbb1d9 (patch)
tree89fac6558aac69aceef0249e452c8347b19bcd33
parent025c05bf8a3405131a2d9a67f6a4cf4c6e22af96 (diff)
imprv: Store workspace when closing chat
Fixes #11374
-rw-r--r--gajim/common/setting_values.py4
-rw-r--r--gajim/gtk/chat_list_stack.py5
-rw-r--r--gajim/gtk/main.py8
3 files changed, 16 insertions, 1 deletions
diff --git a/gajim/common/setting_values.py b/gajim/common/setting_values.py
index d91856e3a..ec52aa6af 100644
--- a/gajim/common/setting_values.py
+++ b/gajim/common/setting_values.py
@@ -378,6 +378,7 @@ StringGroupChatSettings = Literal[
'mute_until',
'speller_language',
'send_chatstate',
+ 'workspace',
]
IntGroupChatSettings = Literal[
@@ -401,6 +402,7 @@ StringContactSettings = Literal[
'mute_until',
'speller_language',
'send_chatstate',
+ 'workspace',
]
AllContactSettings = Literal[BoolContactSettings,
@@ -485,6 +487,7 @@ ACCOUNT_SETTINGS = {
'send_chatstate': HAS_ACCOUNT_DEFAULT,
'send_marker': HAS_ACCOUNT_DEFAULT,
'speller_language': '',
+ 'workspace': '',
},
'group_chat': {
@@ -497,6 +500,7 @@ ACCOUNT_SETTINGS = {
'send_marker': HAS_ACCOUNT_DEFAULT,
'speller_language': '',
'sync_threshold': HAS_APP_DEFAULT,
+ 'workspace': '',
},
}
diff --git a/gajim/gtk/chat_list_stack.py b/gajim/gtk/chat_list_stack.py
index 8362a7b4e..e39c83029 100644
--- a/gajim/gtk/chat_list_stack.py
+++ b/gajim/gtk/chat_list_stack.py
@@ -212,6 +212,11 @@ class ChatListStack(Gtk.Stack, EventHelper):
def store_open_chats(self, workspace_id: str) -> None:
chat_list = self._chat_lists[workspace_id]
open_chats = chat_list.get_open_chats()
+ for chat in open_chats:
+ client = app.get_client(chat['account'])
+ contact = client.get_module('Contacts').get_contact(chat['jid'])
+ contact.settings.set('workspace', workspace_id)
+
app.settings.set_workspace_setting(
workspace_id, 'chats', open_chats)
diff --git a/gajim/gtk/main.py b/gajim/gtk/main.py
index 415d59232..f3cb06381 100644
--- a/gajim/gtk/main.py
+++ b/gajim/gtk/main.py
@@ -931,8 +931,14 @@ class MainWindow(Gtk.ApplicationWindow, EventHelper):
if chat_list is not None:
return chat_list.workspace_id
- default = app.settings.get_account_setting(account, 'default_workspace')
workspaces = app.settings.get_workspaces()
+
+ last_workspace = app.settings.get_contact_setting(
+ account, jid, 'workspace')
+ if last_workspace in workspaces:
+ return last_workspace
+
+ default = app.settings.get_account_setting(account, 'default_workspace')
if default in workspaces:
return default