[michelle] fix the error when starting with emoticons off

This commit is contained in:
Nikos Kouremenos 2005-11-17 17:08:56 +00:00
parent 4f74f23796
commit cfb8d93b2a
2 changed files with 11 additions and 8 deletions

View File

@ -91,17 +91,18 @@ class Chat:
self.notebook.set_show_border(gajim.config.get('tabs_border'))
if gajim.config.get('useemoticons'):
self.emoticons_menu = self.emoticons_menu()
self.emoticons_menu = self.prepare_emoticons_menu()
# muc attention states (when we are mentioned in a muc)
# if the room jid is in the list, the room has mentioned us
self.muc_attentions = []
def update_emoticons_button(self):
def toggle_emoticons(self):
for jid in self.xmls:
if gajim.config.get('useemoticons'):
self.xmls[jid].get_widget('emoticons_button').show()
self.xmls[jid].get_widget('emoticons_button').set_no_show_all(False)
self.emoticons_menu = self.prepare_emoticons_menu()
else:
self.xmls[jid].get_widget('emoticons_button').hide()
self.xmls[jid].get_widget('emoticons_button').set_no_show_all(True)
@ -454,7 +455,7 @@ class Chat:
return menu
def emoticons_menu(self):
def prepare_emoticons_menu(self):
menu = gtk.Menu()
def append_emoticon(w, d):

View File

@ -501,18 +501,20 @@ class PreferencesWindow:
def on_use_emoticons_checkbutton_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'useemoticons',
[self.xml.get_widget('add_remove_emoticons_button')])
self.update_emoticons_button()
gajim.interface.init_emoticons()
gajim.interface.make_regexps()
self.toggle_emoticons()
def update_emoticons_button(self):
'''Update emoticons button in Opened Chat Windows'''
def toggle_emoticons(self):
'''Update emoticons state in Opened Chat Windows'''
for a in gajim.connections:
for kind in ('chats', 'gc'):
windows = gajim.interface.instances[a][kind]
if windows.has_key('tabbed'):
windows['tabbed'].update_emoticons_button()
windows['tabbed'].toggle_emoticons()
else:
for jid in windows.keys():
windows[jid].update_emoticons_button()
windows[jid].toggle_emoticons()
def on_add_remove_emoticons_button_clicked(self, widget):
if gajim.interface.instances.has_key('manage_emots'):