use a per-textview var to remember which language is set instead of the global speller_language one.

This commit is contained in:
Yann Leboulanger 2006-09-04 08:00:49 +00:00
parent 7f6ec376dc
commit d0c359f134
2 changed files with 6 additions and 3 deletions

View File

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

View File

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