Move account specific settings

Move some settings from Prefrences to Accounts
This commit is contained in:
Philipp Hörist 2019-04-20 16:57:56 +02:00
parent e34886ae47
commit b134fccf94
3 changed files with 35 additions and 101 deletions

View File

@ -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>

View File

@ -575,9 +575,13 @@ class AccountPage(GenericSettingPage):
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 @@ class AccountPage(GenericSettingPage):
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 @@ class GeneralPage(GenericSettingPage):
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):

View File

@ -282,34 +282,6 @@ class Preferences(Gtk.ApplicationWindow):
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':