From b134fccf94c224b64b564fd879b2307d87025ba8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=B6rist?= <philipp@hoerist.com> Date: Sat, 20 Apr 2019 16:57:56 +0200 Subject: [PATCH] Move account specific settings Move some settings from Prefrences to Accounts --- gajim/data/gui/preferences_window.ui | 74 +--------------------------- gajim/gtk/accounts.py | 34 +++++++++++++ gajim/gtk/preferences.py | 28 ----------- 3 files changed, 35 insertions(+), 101 deletions(-) diff --git a/gajim/data/gui/preferences_window.ui b/gajim/data/gui/preferences_window.ui index 30908d824e..edbdbeda0c 100644 --- a/gajim/data/gui/preferences_window.ui +++ b/gajim/data/gui/preferences_window.ui @@ -1774,78 +1774,6 @@ $T will be replaced by auto-not-available timeout.</property> <property name="margin_top">6</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <child> - <object class="GtkCheckButton" id="send_idle_time_checkbutton"> - <property name="label" translatable="yes">Allow my idle _time to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the idle time of your system</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_idle_time_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="send_time_info_checkbutton"> - <property name="label" translatable="yes">_Allow local system time information to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the local time on your system</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_time_info_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="send_os_info_checkbutton"> - <property name="label" translatable="yes">Allow client / _OS information to be sent</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, others will be allowed to detect the operating system you are using</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_send_os_info_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">2</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="ignore_events_from_unknown_contacts_checkbutton"> - <property name="label" translatable="yes">_Ignore events from contacts not in the roster</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="tooltip_text" translatable="yes">If checked, incoming events from unauthorized contacts will be ignored. Use with caution, because it blocks all messages from any contact that is not in the roster.</property> - <property name="halign">start</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <signal name="toggled" handler="on_ignore_events_from_unknown_contacts_checkbutton_toggled" swapped="no"/> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">3</property> - </packing> - </child> <child> <object class="GtkBox"> <property name="visible">True</property> @@ -1897,7 +1825,7 @@ $T will be replaced by auto-not-available timeout.</property> <packing> <property name="expand">False</property> <property name="fill">True</property> - <property name="position">4</property> + <property name="position">0</property> </packing> </child> </object> diff --git a/gajim/gtk/accounts.py b/gajim/gtk/accounts.py index 119cd079f6..71886adc67 100644 --- a/gajim/gtk/accounts.py +++ b/gajim/gtk/accounts.py @@ -575,9 +575,13 @@ def __init__(self, account, parent=None): general = partial( self.set_page, GeneralPage(account, self), 'general') + connection = partial( self.set_page, ConnectionPage(account, self), 'connection') + privacy = partial( + self.set_page, PrivacyPage(account, self), 'privacy') + settings = [ Setting(SettingKind.ENTRY, _('Label'), SettingType.ACCOUNT_CONFIG, 'account_label', @@ -592,6 +596,9 @@ def __init__(self, account, parent=None): Setting(SettingKind.CALLBACK, _('General'), name='general', props={'callback': general}), + Setting(SettingKind.CALLBACK, _('Privacy'), + name='privacy', props={'callback': privacy}), + Setting(SettingKind.CALLBACK, _('Connection'), name='connection', props={'callback': connection}), @@ -644,6 +651,33 @@ def __init__(self, account, parent=None): GenericSettingPage.__init__(self, account, parent, settings) +class PrivacyPage(GenericSettingPage): + def __init__(self, account, parent=None): + + settings = [ + Setting(SettingKind.SWITCH, _('Idle Time'), + SettingType.ACCOUNT_CONFIG, 'send_idle_time', + desc=_('Disclose the time of your last activity')), + + Setting(SettingKind.SWITCH, _('Local System Time'), + SettingType.ACCOUNT_CONFIG, 'send_time_info', + desc=_('Disclose the local system time of the ' + 'device Gajim runs on')), + + Setting(SettingKind.SWITCH, _('Client / Operating System'), + SettingType.ACCOUNT_CONFIG, 'send_os_info', + desc=_('Disclose informations about the client ' + 'and operating system you currently use')), + + Setting(SettingKind.SWITCH, _('Ignore Unknown Contacts'), + SettingType.ACCOUNT_CONFIG, 'ignore_unknown_contacts', + desc=_('Ignore everything from contacts not in your ' + 'Roster')), + + ] + GenericSettingPage.__init__(self, account, parent, settings) + + class ConnectionPage(GenericSettingPage): def __init__(self, account, parent=None): diff --git a/gajim/gtk/preferences.py b/gajim/gtk/preferences.py index 3d477c052d..82c8b0f251 100644 --- a/gajim/gtk/preferences.py +++ b/gajim/gtk/preferences.py @@ -282,34 +282,6 @@ def __init__(self): buf.connect('end-user-action', self.on_msg_textview_changed) ### Privacy tab ### - # Send idle time - st = self.get_per_account_option('send_idle_time') - if st == 'mixed': - self._ui.send_idle_time_checkbutton.set_inconsistent(True) - else: - self._ui.send_idle_time_checkbutton.set_active(st) - - # Send absolute time info - st = self.get_per_account_option('send_time_info') - if st == 'mixed': - self._ui.send_time_info_checkbutton.set_inconsistent(True) - else: - self._ui.send_time_info_checkbutton.set_active(st) - - # Send OS info - st = self.get_per_account_option('send_os_info') - if st == 'mixed': - self._ui.send_os_info_checkbutton.set_inconsistent(True) - else: - self._ui.send_os_info_checkbutton.set_active(st) - - # Ignore messages from unknown contacts - st = self.get_per_account_option('ignore_unknown_contacts') - if st == 'mixed': - self._ui.ignore_events_from_unknown_contacts_checkbutton.set_inconsistent(True) - else: - self._ui.ignore_events_from_unknown_contacts_checkbutton.set_active(st) - # Outgoing chat state notifications st = app.config.get('outgoing_chat_state_notifications') if st == 'all': -- GitLab