Philipp Hörist pushed to branch master at gajim / gajim


Commits:
31515c82 by lovetox at 2022-06-15T21:46:49+02:00
fix: Remove ask for status settings

Following settings are removed

- ask_offline_status
- always_ask_for_status_message

With the new UI these settings make not much sense anymore as the
status message field is right under the status selector.

Fixes #10986

- - - - -


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:

=====================================
gajim/common/helpers.py
=====================================
@@ -1396,20 +1396,6 @@ def get_idle_status_message(state: str, status_message: 
str) -> str:
     return message
 
 
-def ask_for_status_message(status: str, signin: bool = False) -> bool:
-    if status is None:
-        # We try to change the message
-        return True
-
-    if signin:
-        return app.settings.get('ask_online_status')
-
-    if status == 'offline':
-        return app.settings.get('ask_offline_status')
-
-    return app.settings.get('always_ask_for_status_message')
-
-
 def get_group_chat_nick(account: str, room_jid: Union[JID, str]) -> str:
     nick = app.nicks[account]
 


=====================================
gajim/common/setting_values.py
=====================================
@@ -37,11 +37,9 @@ class _ACCOUNT_DEFAULT:
 # pylint: disable=line-too-long
 
 BoolSettings = Literal[
-    'always_ask_for_status_message',
     'always_english_wikipedia',
     'always_english_wiktionary',
     'ascii_formatting',
-    'ask_offline_status',
     'ask_online_status',
     'autoaway',
     'autoxa',
@@ -175,11 +173,9 @@ class _ACCOUNT_DEFAULT:
 AllSettingsT = Union[str, int, bool]
 
 APP_SETTINGS = {
-    'always_ask_for_status_message': False,
     'always_english_wikipedia': False,
     'always_english_wiktionary': True,
     'ascii_formatting': True,
-    'ask_offline_status': False,
     'ask_online_status': False,
     'audio_input_device': 'autoaudiosrc ! volume name=gajim_vol',
     'audio_input_volume': 50,


=====================================
gajim/gtk/main.py
=====================================
@@ -36,7 +36,6 @@
 from gajim.common.const import Display
 from gajim.common.const import SimpleClientState
 from gajim.common.ged import EventHelper
-from gajim.common.helpers import ask_for_status_message
 from gajim.common.i18n import _
 from gajim.common.modules.bytestream import is_transfer_active
 from gajim.plugins.pluginmanager import PluginManifest
@@ -875,13 +874,6 @@ def _on_file_request(self, event: 
events.FileRequestReceivedEvent) -> None:
         self._main_stack.process_event(event)
 
     def quit(self) -> None:
-        accounts = list(app.connections.keys())
-        get_msg = False
-        for acct in accounts:
-            if app.account_is_available(acct):
-                get_msg = True
-                break
-
         save_main_window_position()
         window_width, window_height = self.get_size()
         app.settings.set('mainwin_width', window_width)
@@ -937,11 +929,7 @@ def on_continue(message: Optional[str]) -> None:
                 return
             on_continue2(message)
 
-        if get_msg and ask_for_status_message('offline'):
-            print('TODO: Let user choose status message')
-            on_continue('')  # status message here
-        else:
-            on_continue('')
+        on_continue('')
 
     def _on_plugin_updates_available(self,
                                      _repository: PluginRepository,


=====================================
gajim/gtk/preferences.py
=====================================
@@ -559,16 +559,6 @@ def __init__(self, *args: Any) -> None:
                     _('Sign In'),
                     SettingType.CONFIG,
                     'ask_online_status'),
-
-            Setting(SettingKind.SWITCH,
-                    _('Sign Out'),
-                    SettingType.CONFIG,
-                    'ask_offline_status'),
-
-            Setting(SettingKind.SWITCH,
-                    _('Status Change'),
-                    SettingType.CONFIG,
-                    'always_ask_for_status_message'),
         ]
 
         PreferenceBox.__init__(self, settings)


=====================================
gajim/gui_interface.py
=====================================
@@ -67,7 +67,6 @@
 from gajim.common.events import FileHashError
 from gajim.common.events import FileProgress
 from gajim.common.events import FileError
-from gajim.common.helpers import ask_for_status_message
 from gajim.common.structs import OutgoingMessage
 from gajim.common.i18n import _
 from gajim.common.client import Client
@@ -164,7 +163,7 @@ def handle_event_signed_in(event):
         if event.conn.get_module('MAM').available:
             event.conn.get_module('MAM').request_archive_on_signin()
 
-        if ask_for_status_message(event.conn.status, signin=True):
+        if app.settings.get('ask_online_status'):
             app.window.show_account_page(account)
 
     def handle_event_presence(self, event):
@@ -565,18 +564,10 @@ def change_status(self,
                       status: str,
                       account: Optional[str] = None
                       ) -> None:
-        ask = ask_for_status_message(status)
 
         if status is None:
             status = helpers.get_global_show()
 
-        if ask:
-            if account is None:
-                app.window.show_app_page()
-            else:
-                app.window.show_account_page(account)
-            return
-
         if account is not None:
             self._change_status(account, status)
             return



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/31515c8259744dcd0140809b76c1756ab82b6141

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/31515c8259744dcd0140809b76c1756ab82b6141
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

Reply via email to