diff --git a/src/chat_control.py b/src/chat_control.py index 02edbe422..db4cfb92c 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -188,8 +188,9 @@ class ChatControlBase(MessageControl): # now set the one the user selected lang = gajim.config.get('speller_language') if lang: + self.msg_textview.lang = lang spell.set_language(lang) - except gobject.GError, msg: + except (gobject.GError, RuntimeError), msg: #FIXME: add a ui for this use spell.set_language() dialogs.ErrorDialog(unicode(msg), _('If that is not your language ' 'for which you want to highlight misspelled words, then please ' @@ -210,6 +211,7 @@ class ChatControlBase(MessageControl): def _on_select_dictionary(widget, lang): gajim.config.set('speller_language', lang) spell = gtkspell.get_from_text_view(self.msg_textview) + self.msg_textview.lang = lang spell.set_language(lang) widget.set_active(True) @@ -221,10 +223,9 @@ class ChatControlBase(MessageControl): menu.prepend(item) submenu = gtk.Menu() item.set_submenu(submenu) - deflang = gajim.config.get('speller_language') for lang in sorted(langs): item = gtk.CheckMenuItem(lang) - if langs[lang] == deflang: + if langs[lang] == self.msg_textview.lang: item.set_active(True) submenu.append(item) id = item.connect('activate', _on_select_dictionary, langs[lang]) diff --git a/src/message_textview.py b/src/message_textview.py index 09de8b53c..cdf21ab54 100644 --- a/src/message_textview.py +++ b/src/message_textview.py @@ -50,6 +50,8 @@ class MessageTextView(gtk.TextView): self.set_pixels_above_lines(2) self.set_pixels_below_lines(2) + self.lang = None # Lang used for spell checking + def destroy(self): import gc gobject.idle_add(lambda:gc.collect())