Adapt to upstream app.settings changes

This commit is contained in:
wurstsalat
2020-09-12 11:45:27 +02:00
parent 384cdfce8a
commit 129afcddad
5 changed files with 15 additions and 14 deletions

View File

@@ -96,16 +96,16 @@ class ClickableNicknames(GajimPlugin):
# Remove Space # Remove Space
nickname = nickname[:-1] nickname = nickname[:-1]
nickname = nickname.rstrip(app.config.get('after_nickname')) nickname = nickname.rstrip(app.settings.get('after_nickname'))
# Remove direction mark # Remove direction mark
nickname = nickname[:-1] nickname = nickname[:-1]
nickname = nickname.lstrip(app.config.get('before_nickname')) nickname = nickname.lstrip(app.settings.get('before_nickname'))
message_input.grab_focus() message_input.grab_focus()
if not message_input.has_text(): if not message_input.has_text():
# There is no text add refer char # There is no text add refer char
nickname = '%s%s ' % (nickname, nickname = '%s%s ' % (nickname,
app.config.get('gc_refer_to_nick_char')) app.settings.get('gc_refer_to_nick_char'))
else: else:
input_buffer = message_input.get_buffer() input_buffer = message_input.get_buffer()
start, end = input_buffer.get_bounds() start, end = input_buffer.get_bounds()

View File

@@ -76,8 +76,8 @@ class KeyStore:
def _migrate_v1_store(self): def _migrate_v1_store(self):
keys = {} keys = {}
attached_keys = app.config.get_per( attached_keys = app.settings.get_account_setting(
'accounts', self._account, 'attached_gpg_keys') self._account, 'attached_gpg_keys')
if not attached_keys: if not attached_keys:
return return
attached_keys = attached_keys.split() attached_keys = attached_keys.split()
@@ -88,13 +88,14 @@ class KeyStore:
for jid, key_id in keys.items(): for jid, key_id in keys.items():
self._set_contact_key_data_nosync(jid, (key_id, '')) self._set_contact_key_data_nosync(jid, (key_id, ''))
own_key_id = app.config.get_per('accounts', self._account, 'keyid') own_key_id = app.settings.get_account_setting(self._account, 'keyid')
own_key_user = app.config.get_per('accounts', self._account, 'keyname') own_key_user = app.settings.get_account_setting(
self._account, 'keyname')
if own_key_id: if own_key_id:
self._set_own_key_data_nosync((own_key_id, own_key_user)) self._set_own_key_data_nosync((own_key_id, own_key_user))
attached_keys = app.config.set_per( attached_keys = app.settings.set_account_setting(
'accounts', self._account, 'attached_gpg_keys', '') self._account, 'attached_gpg_keys', '')
self._log.info('Migration from store v1 was successful') self._log.info('Migration from store v1 was successful')
def _migrate_v2_store(self): def _migrate_v2_store(self):

View File

@@ -99,11 +99,11 @@ class SetLocationPlugin(GajimPlugin):
if account is None: if account is None:
# Set geo for all accounts # Set geo for all accounts
for acct in app.connections: for acct in app.connections:
if app.config.get_per('accounts', acct, 'publish_location'): if app.settings.get_account_setting(acct, 'publish_location'):
app.connections[acct].get_module('UserLocation').set_location( app.connections[acct].get_module('UserLocation').set_location(
LocationData(**data)) LocationData(**data))
elif app.config.get_per('accounts', account, 'publish_location'): elif app.settings.get_account_setting(account, 'publish_location'):
app.connections[account].get_module('UserLocation').set_location( app.connections[account].get_module('UserLocation').set_location(
LocationData(**data)) LocationData(**data))

View File

@@ -154,7 +154,7 @@ class UrlImagePreviewPlugin(GajimPlugin):
if GLib.mkdir_with_parents(str(self._thumb_dir), 0o700) != 0: if GLib.mkdir_with_parents(str(self._thumb_dir), 0o700) != 0:
log.error('Failed to create: %s', self._thumb_dir) log.error('Failed to create: %s', self._thumb_dir)
if app.config.get('use_kib_mib'): if app.settings.get('use_kib_mib'):
self._units = GLib.FormatSizeFlags.IEC_UNITS self._units = GLib.FormatSizeFlags.IEC_UNITS
else: else:
self._units = GLib.FormatSizeFlags.DEFAULT self._units = GLib.FormatSizeFlags.DEFAULT
@@ -698,7 +698,7 @@ class UrlImagePreviewPlugin(GajimPlugin):
return return
FileSaveDialog(on_ok, FileSaveDialog(on_ok,
path=app.config.get('last_save_dir'), path=app.settings.get('last_save_dir'),
file_name=preview.filename, file_name=preview.filename,
transient_for=app.app.get_active_window()) transient_for=app.app.get_active_window())

View File

@@ -140,7 +140,7 @@ class Whiteboard(object):
def _on_export_button_clicked(self, widget): def _on_export_button_clicked(self, widget):
SvgSaveDialog(self.image.export_svg, SvgSaveDialog(self.image.export_svg,
file_name=_('whiteboard.svg'), file_name=_('whiteboard.svg'),
path=app.config.get('last_save_dir'), path=app.settings.get('last_save_dir'),
transient_for=app.app.get_active_window()) transient_for=app.app.get_active_window())
def item_created(self, canvas, item, model): def item_created(self, canvas, item, model):