Dynamic reconfig of gtkspell option works again

This commit is contained in:
Travis Shirk 2006-01-19 02:24:02 +00:00
parent c0297ac445
commit 1048936e21
1 changed files with 24 additions and 24 deletions

View File

@ -37,6 +37,7 @@ import dialogs
import vcard import vcard
import cell_renderer_image import cell_renderer_image
import message_control import message_control
import chat_control
try: try:
import gtkspell import gtkspell
@ -541,40 +542,39 @@ class PreferencesWindow:
gajim.interface.save_config() gajim.interface.save_config()
gajim.interface.msg_win_mgr.reconfig() gajim.interface.msg_win_mgr.reconfig()
def apply_speller(self, kind): def apply_speller(self):
for acct in gajim.connections: for acct in gajim.connections:
windows = gajim.interface.instances[acct][kind] for ctrl in gajim.interface.msg_win_mgr.controls():
jids = windows.keys() if isinstance(ctrl, chat_control.ChatControlBase):
for jid in jids: try:
if jid == 'tabbed': spell_obj = gtkspell.get_from_text_view(ctrl.msg_textview)
continue except:
window = windows[jid] spell_obj = None
textview = window.message_textviews[jid]
gtkspell.Spell(textview)
def remove_speller(self, kind): print "Current: ", spell_obj
if not spell_obj:
gtkspell.Spell(ctrl.msg_textview)
def remove_speller(self):
for acct in gajim.connections: for acct in gajim.connections:
windows = gajim.interface.instances[acct][kind] for ctrl in gajim.interface.msg_win_mgr.controls():
jids = windows.keys() if isinstance(ctrl, chat_control.ChatControlBase):
for jid in jids: try:
if jid == 'tabbed': spell_obj = gtkspell.get_from_text_view(ctrl.msg_textview)
continue except:
window = windows[jid] spell_obj = None
textview = window.message_textviews[jid] print "Current: ", spell_obj
spell_obj = gtkspell.get_from_text_view(textview) if spell_obj:
if spell_obj: spell_obj.detach()
spell_obj.detach()
def on_speller_checkbutton_toggled(self, widget): def on_speller_checkbutton_toggled(self, widget):
active = widget.get_active() active = widget.get_active()
gajim.config.set('use_speller', active) gajim.config.set('use_speller', active)
gajim.interface.save_config() gajim.interface.save_config()
if active: if active:
self.apply_speller('chats') self.apply_speller()
self.apply_speller('gc')
else: else:
self.remove_speller('chats') self.remove_speller()
self.remove_speller('gc')
def update_print_time(self): def update_print_time(self):
'''Update time in Opened Chat Windows''' '''Update time in Opened Chat Windows'''