From cfb8d93b2abfe4ba66727bd48701a05ce872cce1 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Thu, 17 Nov 2005 17:08:56 +0000 Subject: [PATCH] [michelle] fix the error when starting with emoticons off --- src/chat.py | 7 ++++--- src/config.py | 12 +++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/chat.py b/src/chat.py index 37a847599..57cd77a4a 100644 --- a/src/chat.py +++ b/src/chat.py @@ -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): diff --git a/src/config.py b/src/config.py index 234777f2a..37298c6f1 100644 --- a/src/config.py +++ b/src/config.py @@ -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'):