check if dictionary is installed when enabling spell checking and at gajim startup. For #2387

This commit is contained in:
Yann Leboulanger 2006-09-10 22:25:07 +00:00
parent 532e0bb60a
commit 875f4f8894
2 changed files with 33 additions and 2 deletions

View File

@ -620,6 +620,22 @@ class PreferencesWindow:
gajim.config.set('use_speller', active) gajim.config.set('use_speller', active)
gajim.interface.save_config() gajim.interface.save_config()
if active: if active:
lang = gajim.config.get('speller_language')
if not lang:
lang = gajim.LANG
tv = gtk.TextView()
try:
spell = gtkspell.Spell(tv, lang)
except:
dialogs.ErrorDialog(
_('Dictionary for lang %s not available') % lang,
_('You have to install %s dictionary to use spellchecking, or '
'choose another language by setting the speller_language option.'
) % lang)
gajim.config.set('use_speller', False)
widget.set_active(False)
else:
gajim.config.set('speller_language', lang)
self.apply_speller() self.apply_speller()
else: else:
self.remove_speller() self.remove_speller()

View File

@ -1923,6 +1923,21 @@ class Interface:
# get transports type from DB # get transports type from DB
gajim.transport_type = gajim.logger.get_transports_type() gajim.transport_type = gajim.logger.get_transports_type()
# test is dictionnary is present for speller
if gajim.config.get('use_speller'):
lang = gajim.config.get('speller_language')
if not lang:
lang = gajim.LANG
tv = gtk.TextView()
try:
spell = gtkspell.Spell(tv, lang)
except:
dialogs.ErrorDialog(
_('Dictionary for lang %s not available') % lang,
_('You have to install %s dictionary to use spellchecking, or '
'choose another language by setting the speller_language option.'
) % lang)
gajim.config.set('use_speller', False)
gobject.timeout_add(100, self.autoconnect) gobject.timeout_add(100, self.autoconnect)
gobject.timeout_add(200, self.process_connections) gobject.timeout_add(200, self.process_connections)
gobject.timeout_add(500, self.read_sleepy) gobject.timeout_add(500, self.read_sleepy)