From 7759dd92891216bc06693abdd1181423207e2f5e Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 12 Sep 2006 07:30:19 +0000 Subject: [PATCH] save speller_language per room. Fixes #2387 --- src/chat_control.py | 22 +++++++++++++++------- src/common/config.py | 3 +++ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index 28ab084cf..e7e5724ba 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -184,7 +184,10 @@ class ChatControlBase(MessageControl): except: del langs[lang] # now set the one the user selected - lang = gajim.config.get_per('contacts', self.contact.jid, + per_type = 'contacts' + if self.type_id == message_control.TYPE_GC: + per_type = 'rooms' + lang = gajim.config.get_per(per_type, self.contact.jid, 'speller_language') if not lang: # use the default one @@ -211,7 +214,12 @@ class ChatControlBase(MessageControl): def on_msg_textview_populate_popup(self, textview, menu): '''we override the default context menu and we prepend an option to switch languages''' def _on_select_dictionary(widget, lang): - gajim.config.set_per('contacts', self.contact.jid, 'speller_language', + per_type = 'contacts' + if self.type_id == message_control.TYPE_GC: + per_type = 'rooms' + if not gajim.config.get_per(per_type, self.contact.jid): + gajim.config.add_per(per_type, self.contact.jid) + gajim.config.set_per(per_type, self.contact.jid, 'speller_language', lang) spell = gtkspell.get_from_text_view(self.msg_textview) self.msg_textview.lang = lang @@ -1076,12 +1084,12 @@ class ChatControl(ChatControlBase): tt = _('OpenPGP Encryption') # restore gpg pref - gpg_pref = gajim.config.get_per('contacts', - self.contact.get_full_jid(), 'gpg_enabled') + gpg_pref = gajim.config.get_per('contacts', self.contact.jid, + 'gpg_enabled') if gpg_pref == None: - gajim.config.add_per('contacts', self.contact.get_full_jid()) - gpg_pref = gajim.config.get_per('contacts', - self.contact.get_full_jid(), 'gpg_enabled') + gajim.config.add_per('contacts', self.contact.jid) + gpg_pref = gajim.config.get_per('contacts', self.contact.jid, + 'gpg_enabled') tb.set_active(gpg_pref) else: diff --git a/src/common/config.py b/src/common/config.py index 0e0ebb9cd..544333ff3 100644 --- a/src/common/config.py +++ b/src/common/config.py @@ -299,6 +299,9 @@ class Config: 'gpg_enabled': [ opt_bool, True, _('Do we have GPG enabled for this contact')], 'speller_language': [ opt_str, '', _('Language for which we want to check misspeller words')], }, {}), + 'rooms': ({ + 'speller_language': [ opt_str, '', _('Language for which we want to check misspeller words')], + }, {}), 'notifications': ({ 'event': [opt_str, ''], 'recipient_type': [opt_str, 'all'],