From 129afcddad8aa90699e80c32c18403685540aba4 Mon Sep 17 00:00:00 2001 From: wurstsalat Date: Sat, 12 Sep 2020 11:45:27 +0200 Subject: [PATCH] Adapt to upstream app.settings changes --- clickable_nicknames/clickable_nicknames.py | 6 +++--- pgp/backend/store.py | 13 +++++++------ set_location/set_location.py | 4 ++-- url_image_preview/url_image_preview.py | 4 ++-- whiteboard/whiteboard_widget.py | 2 +- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/clickable_nicknames/clickable_nicknames.py b/clickable_nicknames/clickable_nicknames.py index 00f1d59..e672007 100644 --- a/clickable_nicknames/clickable_nicknames.py +++ b/clickable_nicknames/clickable_nicknames.py @@ -96,16 +96,16 @@ class ClickableNicknames(GajimPlugin): # Remove Space nickname = nickname[:-1] - nickname = nickname.rstrip(app.config.get('after_nickname')) + nickname = nickname.rstrip(app.settings.get('after_nickname')) # Remove direction mark nickname = nickname[:-1] - nickname = nickname.lstrip(app.config.get('before_nickname')) + nickname = nickname.lstrip(app.settings.get('before_nickname')) message_input.grab_focus() if not message_input.has_text(): # There is no text add refer char nickname = '%s%s ' % (nickname, - app.config.get('gc_refer_to_nick_char')) + app.settings.get('gc_refer_to_nick_char')) else: input_buffer = message_input.get_buffer() start, end = input_buffer.get_bounds() diff --git a/pgp/backend/store.py b/pgp/backend/store.py index 22b195b..822f53c 100644 --- a/pgp/backend/store.py +++ b/pgp/backend/store.py @@ -76,8 +76,8 @@ class KeyStore: def _migrate_v1_store(self): keys = {} - attached_keys = app.config.get_per( - 'accounts', self._account, 'attached_gpg_keys') + attached_keys = app.settings.get_account_setting( + self._account, 'attached_gpg_keys') if not attached_keys: return attached_keys = attached_keys.split() @@ -88,13 +88,14 @@ class KeyStore: for jid, key_id in keys.items(): self._set_contact_key_data_nosync(jid, (key_id, '')) - own_key_id = app.config.get_per('accounts', self._account, 'keyid') - own_key_user = app.config.get_per('accounts', self._account, 'keyname') + own_key_id = app.settings.get_account_setting(self._account, 'keyid') + own_key_user = app.settings.get_account_setting( + self._account, 'keyname') if own_key_id: self._set_own_key_data_nosync((own_key_id, own_key_user)) - attached_keys = app.config.set_per( - 'accounts', self._account, 'attached_gpg_keys', '') + attached_keys = app.settings.set_account_setting( + self._account, 'attached_gpg_keys', '') self._log.info('Migration from store v1 was successful') def _migrate_v2_store(self): diff --git a/set_location/set_location.py b/set_location/set_location.py index c41a973..618af71 100644 --- a/set_location/set_location.py +++ b/set_location/set_location.py @@ -99,11 +99,11 @@ class SetLocationPlugin(GajimPlugin): if account is None: # Set geo for all accounts 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( 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( LocationData(**data)) diff --git a/url_image_preview/url_image_preview.py b/url_image_preview/url_image_preview.py index 20fd47e..e5afca4 100644 --- a/url_image_preview/url_image_preview.py +++ b/url_image_preview/url_image_preview.py @@ -154,7 +154,7 @@ class UrlImagePreviewPlugin(GajimPlugin): if GLib.mkdir_with_parents(str(self._thumb_dir), 0o700) != 0: 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 else: self._units = GLib.FormatSizeFlags.DEFAULT @@ -698,7 +698,7 @@ class UrlImagePreviewPlugin(GajimPlugin): return FileSaveDialog(on_ok, - path=app.config.get('last_save_dir'), + path=app.settings.get('last_save_dir'), file_name=preview.filename, transient_for=app.app.get_active_window()) diff --git a/whiteboard/whiteboard_widget.py b/whiteboard/whiteboard_widget.py index b27f861..08c0af4 100644 --- a/whiteboard/whiteboard_widget.py +++ b/whiteboard/whiteboard_widget.py @@ -140,7 +140,7 @@ class Whiteboard(object): def _on_export_button_clicked(self, widget): SvgSaveDialog(self.image.export_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()) def item_created(self, canvas, item, model):