Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
31515c82
by lovetox at 2022-06-15T21:46:49+02:00
5 changed files:
- gajim/common/helpers.py
- gajim/common/setting_values.py
- gajim/gtk/main.py
- gajim/gtk/preferences.py
- gajim/gui_interface.py
Changes:
| ... | ... | @@ -1396,20 +1396,6 @@ def get_idle_status_message(state: str, status_message: str) -> str: |
| 1396 | 1396 | return message
|
| 1397 | 1397 | |
| 1398 | 1398 | |
| 1399 | -def ask_for_status_message(status: str, signin: bool = False) -> bool:
|
|
| 1400 | - if status is None:
|
|
| 1401 | - # We try to change the message
|
|
| 1402 | - return True
|
|
| 1403 | - |
|
| 1404 | - if signin:
|
|
| 1405 | - return app.settings.get('ask_online_status')
|
|
| 1406 | - |
|
| 1407 | - if status == 'offline':
|
|
| 1408 | - return app.settings.get('ask_offline_status')
|
|
| 1409 | - |
|
| 1410 | - return app.settings.get('always_ask_for_status_message')
|
|
| 1411 | - |
|
| 1412 | - |
|
| 1413 | 1399 | def get_group_chat_nick(account: str, room_jid: Union[JID, str]) -> str:
|
| 1414 | 1400 | nick = app.nicks[account]
|
| 1415 | 1401 |
| ... | ... | @@ -37,11 +37,9 @@ class _ACCOUNT_DEFAULT: |
| 37 | 37 | # pylint: disable=line-too-long
|
| 38 | 38 | |
| 39 | 39 | BoolSettings = Literal[
|
| 40 | - 'always_ask_for_status_message',
|
|
| 41 | 40 | 'always_english_wikipedia',
|
| 42 | 41 | 'always_english_wiktionary',
|
| 43 | 42 | 'ascii_formatting',
|
| 44 | - 'ask_offline_status',
|
|
| 45 | 43 | 'ask_online_status',
|
| 46 | 44 | 'autoaway',
|
| 47 | 45 | 'autoxa',
|
| ... | ... | @@ -175,11 +173,9 @@ class _ACCOUNT_DEFAULT: |
| 175 | 173 | AllSettingsT = Union[str, int, bool]
|
| 176 | 174 | |
| 177 | 175 | APP_SETTINGS = {
|
| 178 | - 'always_ask_for_status_message': False,
|
|
| 179 | 176 | 'always_english_wikipedia': False,
|
| 180 | 177 | 'always_english_wiktionary': True,
|
| 181 | 178 | 'ascii_formatting': True,
|
| 182 | - 'ask_offline_status': False,
|
|
| 183 | 179 | 'ask_online_status': False,
|
| 184 | 180 | 'audio_input_device': 'autoaudiosrc ! volume name=gajim_vol',
|
| 185 | 181 | 'audio_input_volume': 50,
|
| ... | ... | @@ -36,7 +36,6 @@ |
| 36 | 36 | from gajim.common.const import Display
|
| 37 | 37 | from gajim.common.const import SimpleClientState
|
| 38 | 38 | from gajim.common.ged import EventHelper
|
| 39 | -from gajim.common.helpers import ask_for_status_message
|
|
| 40 | 39 | from gajim.common.i18n import _
|
| 41 | 40 | from gajim.common.modules.bytestream import is_transfer_active
|
| 42 | 41 | from gajim.plugins.pluginmanager import PluginManifest
|
| ... | ... | @@ -875,13 +874,6 @@ def _on_file_request(self, event: events.FileRequestReceivedEvent) -> None: |
| 875 | 874 | self._main_stack.process_event(event)
|
| 876 | 875 | |
| 877 | 876 | def quit(self) -> None:
|
| 878 | - accounts = list(app.connections.keys())
|
|
| 879 | - get_msg = False
|
|
| 880 | - for acct in accounts:
|
|
| 881 | - if app.account_is_available(acct):
|
|
| 882 | - get_msg = True
|
|
| 883 | - break
|
|
| 884 | - |
|
| 885 | 877 | save_main_window_position()
|
| 886 | 878 | window_width, window_height = self.get_size()
|
| 887 | 879 | app.settings.set('mainwin_width', window_width)
|
| ... | ... | @@ -937,11 +929,7 @@ def on_continue(message: Optional[str]) -> None: |
| 937 | 929 | return
|
| 938 | 930 | on_continue2(message)
|
| 939 | 931 | |
| 940 | - if get_msg and ask_for_status_message('offline'):
|
|
| 941 | - print('TODO: Let user choose status message')
|
|
| 942 | - on_continue('') # status message here
|
|
| 943 | - else:
|
|
| 944 | - on_continue('')
|
|
| 932 | + on_continue('')
|
|
| 945 | 933 | |
| 946 | 934 | def _on_plugin_updates_available(self,
|
| 947 | 935 | _repository: PluginRepository,
|
| ... | ... | @@ -559,16 +559,6 @@ def __init__(self, *args: Any) -> None: |
| 559 | 559 | _('Sign In'),
|
| 560 | 560 | SettingType.CONFIG,
|
| 561 | 561 | 'ask_online_status'),
|
| 562 | - |
|
| 563 | - Setting(SettingKind.SWITCH,
|
|
| 564 | - _('Sign Out'),
|
|
| 565 | - SettingType.CONFIG,
|
|
| 566 | - 'ask_offline_status'),
|
|
| 567 | - |
|
| 568 | - Setting(SettingKind.SWITCH,
|
|
| 569 | - _('Status Change'),
|
|
| 570 | - SettingType.CONFIG,
|
|
| 571 | - 'always_ask_for_status_message'),
|
|
| 572 | 562 | ]
|
| 573 | 563 | |
| 574 | 564 | PreferenceBox.__init__(self, settings)
|
| ... | ... | @@ -67,7 +67,6 @@ |
| 67 | 67 | from gajim.common.events import FileHashError
|
| 68 | 68 | from gajim.common.events import FileProgress
|
| 69 | 69 | from gajim.common.events import FileError
|
| 70 | -from gajim.common.helpers import ask_for_status_message
|
|
| 71 | 70 | from gajim.common.structs import OutgoingMessage
|
| 72 | 71 | from gajim.common.i18n import _
|
| 73 | 72 | from gajim.common.client import Client
|
| ... | ... | @@ -164,7 +163,7 @@ def handle_event_signed_in(event): |
| 164 | 163 | if event.conn.get_module('MAM').available:
|
| 165 | 164 | event.conn.get_module('MAM').request_archive_on_signin()
|
| 166 | 165 | |
| 167 | - if ask_for_status_message(event.conn.status, signin=True):
|
|
| 166 | + if app.settings.get('ask_online_status'):
|
|
| 168 | 167 | app.window.show_account_page(account)
|
| 169 | 168 | |
| 170 | 169 | def handle_event_presence(self, event):
|
| ... | ... | @@ -565,18 +564,10 @@ def change_status(self, |
| 565 | 564 | status: str,
|
| 566 | 565 | account: Optional[str] = None
|
| 567 | 566 | ) -> None:
|
| 568 | - ask = ask_for_status_message(status)
|
|
| 569 | 567 | |
| 570 | 568 | if status is None:
|
| 571 | 569 | status = helpers.get_global_show()
|
| 572 | 570 | |
| 573 | - if ask:
|
|
| 574 | - if account is None:
|
|
| 575 | - app.window.show_app_page()
|
|
| 576 | - else:
|
|
| 577 | - app.window.show_account_page(account)
|
|
| 578 | - return
|
|
| 579 | - |
|
| 580 | 571 | if account is not None:
|
| 581 | 572 | self._change_status(account, status)
|
| 582 | 573 | return
|