Philipp Hörist pushed to branch master at gajim / gajim
Commits: 83906f55 by lovetox at 2022-06-17T19:50:35+02:00 feat: Preferences: Add `Action on Close Button` setting
The new popover setting allows for more than two values and is a more flexibel approach.
- - - - - f2702018 by lovetox at 2022-06-17T19:58:06+02:00 fix: Preferences: Remove `Minimize to Tray` setting
It’s better to leave this up to the window manager and don’t mess with it. Users who don’t want to minimize to tray can either use the tray show/hide button or set the `Action on Close` setting accordingly.
- - - - -
3 changed files:
- gajim/common/setting_values.py - gajim/gtk/main.py - gajim/gtk/preferences.py
Changes:
===================================== gajim/common/setting_values.py ===================================== @@ -66,8 +66,6 @@ class _ACCOUNT_DEFAULT: 'ignore_incoming_attention', 'is_window_visible', 'log_contact_status_changes', - 'minimize_on_window_delete', - 'minimize_to_tray', 'muc_prefer_direct_msg', 'notification_preview_message', 'notify_on_all_muc_messages', @@ -138,6 +136,7 @@ class _ACCOUNT_DEFAULT: ]
StringSettings = Literal[ + 'action_on_close', 'audio_input_device', 'audio_output_device', 'autoaway_message', @@ -234,8 +233,7 @@ class _ACCOUNT_DEFAULT: 'mainwin_width': 1000, 'mainwin_x_position': 0, 'mainwin_y_position': 0, - 'minimize_on_window_delete': True, - 'minimize_to_tray': False, + 'action_on_close': 'hide', 'muc_highlight_words': '', 'muc_prefer_direct_msg': True, 'muclumbus_api_http_uri': 'https://search.jabber.network/api/1.0/search',
===================================== gajim/gtk/main.py ===================================== @@ -422,11 +422,13 @@ def _on_window_delete(self, _event: Gdk.Event ) -> int:
- if app.settings.get('minimize_on_window_delete'): - if app.settings.get('minimize_to_tray'): - self.hide() - else: - self.minimize() + action = app.settings.get('action_on_close') + if action == 'hide': + self.hide() + return Gdk.EVENT_STOP + + if action == 'minimize': + self.minimize() return Gdk.EVENT_STOP
if not app.settings.get('confirm_on_window_delete'):
===================================== gajim/gtk/preferences.py ===================================== @@ -191,6 +191,12 @@ def __init__(self, *args: Any) -> None: 'last_state': _('Restore last state'), }
+ action_on_close_items = { + 'hide': _('Hide'), + 'minimize': _('Minimize'), + 'quit': _('Quit'), + } + settings = [ Setting(SettingKind.POPOVER, _('Show on Startup'), @@ -199,17 +205,12 @@ def __init__(self, *args: Any) -> None: props={'entries': main_window_on_startup_items}, desc=_('Show window when starting Gajim')),
- Setting(SettingKind.SWITCH, - _('Minimize on Close'), - SettingType.CONFIG, - 'minimize_on_window_delete', - desc=_('Minimize when closing Gajim’s window')), - - Setting(SettingKind.SWITCH, - _('Minimize to Tray'), + Setting(SettingKind.POPOVER, + _('Action on Close'), SettingType.CONFIG, - 'minimize_to_tray', - desc=_('Hide window to system tray when minimized')), + 'action_on_close', + props={'entries': action_on_close_items}, + desc=_('Action when closing Gajim’s window')),
Setting(SettingKind.SWITCH, _('Show in Taskbar'),
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/9fb23514a863ba399a02ba4b3608dbbe...