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,7 +620,23 @@ class PreferencesWindow:
gajim.config.set('use_speller', active)
gajim.interface.save_config()
if active:
self.apply_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)
widget.set_active(False)
else:
gajim.config.set('speller_language', lang)
self.apply_speller()
else:
self.remove_speller()
@ -2239,7 +2255,7 @@ class RemoveAccountWindow:
self.window = xml.get_widget('remove_account_window')
self.window.set_transient_for(gajim.interface.roster.window)
self.remove_and_unregister_radiobutton = xml.get_widget(
'remove_and_unregister_radiobutton')
'remove_and_unregister_radiobutton')
self.window.set_title(_('Removing %s account') % self.account)
xml.signal_autoconnect(self)
self.window.show_all()

View File

@ -1923,6 +1923,21 @@ class Interface:
# get transports type from DB
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(200, self.process_connections)
gobject.timeout_add(500, self.read_sleepy)