From 111ea2c9b6dfa69d4d56a6de7313d5b198936227 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger <asterix@lagaule.org> Date: Fri, 31 Mar 2006 20:08:47 +0000 Subject: [PATCH] cleanup ichat mode code. No need of timeout. Fixes #1213 --- src/chat_control.py | 23 ----------------------- src/config.py | 8 -------- src/message_control.py | 8 -------- src/message_window.py | 13 ------------- 4 files changed, 52 deletions(-) diff --git a/src/chat_control.py b/src/chat_control.py index b25223f4bd..74fe0e87d1 100644 --- a/src/chat_control.py +++ b/src/chat_control.py @@ -164,7 +164,6 @@ class ChatControlBase(MessageControl): 'words feature will not be used')).get_response() gajim.config.set('use_speller', False) - self.print_time_timeout_id = None self.style_event_id = 0 def _on_send_button_clicked(self, widget): @@ -533,25 +532,6 @@ class ChatControlBase(MessageControl): start, end = buffer.get_bounds() buffer.delete(start, end) - def print_time_timeout(self, arg): - if gajim.config.get('print_time') == 'sometimes': - conv_textview = self.conv_textview - buffer = conv_textview.get_buffer() - end_iter = buffer.get_end_iter() - tim = time.localtime() - tim_format = time.strftime('%H:%M', tim).decode( - locale.getpreferredencoding()) - buffer.insert_with_tags_by_name(end_iter, '\n' + tim_format, - 'time_sometimes') - # scroll to the end of the textview - if conv_textview.at_the_end(): - # we are at the end - conv_textview.scroll_to_end() - return True # loop again - if self.print_time_timeout_id: - self.print_time_timeout_id = None - return False - def _on_history_menuitem_activate(self, widget = None, jid = None): '''When history menuitem is pressed: call history window''' if not jid: @@ -1304,9 +1284,6 @@ class ChatControl(ChatControlBase): # Disconnect timer callbacks gobject.source_remove(self.possible_paused_timeout_id) gobject.source_remove(self.possible_inactive_timeout_id) - if self.print_time_timeout_id: - gobject.source_remove(self.print_time_timeout_id) - self.print_time_timeout_id = None # Clean up systray if gajim.interface.systray_enabled and self.nb_unread > 0: gajim.interface.systray.remove_jid(self.contact.jid, self.account, diff --git a/src/config.py b/src/config.py index 7de2d08e6d..7fbdad308e 100644 --- a/src/config.py +++ b/src/config.py @@ -591,11 +591,6 @@ class PreferencesWindow: else: self.remove_speller() - def update_print_time(self): - '''Update time in Opened Chat Windows''' - for msg_win in gajim.interface.msg_win_mgr.windows(): - msg_win.update_print_time() - def _set_sensitivity_for_before_after_time_widgets(self, sensitive): self.xml.get_widget('before_time_label').set_sensitive(sensitive) self.xml.get_widget('before_time_entry').set_sensitive(sensitive) @@ -606,21 +601,18 @@ class PreferencesWindow: if widget.get_active(): gajim.config.set('print_time', 'never') self._set_sensitivity_for_before_after_time_widgets(False) - self.update_print_time() gajim.interface.save_config() def on_time_sometimes_radiobutton_toggled(self, widget): if widget.get_active(): gajim.config.set('print_time', 'sometimes') self._set_sensitivity_for_before_after_time_widgets(False) - self.update_print_time() gajim.interface.save_config() def on_time_always_radiobutton_toggled(self, widget): if widget.get_active(): gajim.config.set('print_time', 'always') self._set_sensitivity_for_before_after_time_widgets(True) - self.update_print_time() gajim.interface.save_config() def on_before_time_entry_focus_out_event(self, widget, event): diff --git a/src/message_control.py b/src/message_control.py index 27890c3bac..a01d6ab81d 100644 --- a/src/message_control.py +++ b/src/message_control.py @@ -46,7 +46,6 @@ class MessageControl: self.compact_view_always = False self.compact_view_current = False self.nb_unread = 0 - self.print_time_timeout_id = None self.resource = resource gajim.last_message_time[self.account][self.get_full_jid()] = 0 @@ -97,13 +96,6 @@ class MessageControl: def update_tags(self): pass # NOTE: Derived classes SHOULD implement this - def print_time_timeout(self, arg): - # NOTE: Derived classes SHOULD implement this - if self.print_time_timeout_id: - gobject.source_remove(self.print_time_timeout_id) - self.print_time_timeout_id = None - return False - def get_tab_label(self, chatstate): '''Return a suitable the tab label string. Returns a tuple such as: (label_str, color) either of which can be None diff --git a/src/message_window.py b/src/message_window.py index 4637cfbfeb..93cc434de0 100644 --- a/src/message_window.py +++ b/src/message_window.py @@ -395,19 +395,6 @@ class MessageWindow: for ctrl in ctrl_dict.values(): yield ctrl - def update_print_time(self): - if gajim.config.get('print_time') != 'sometimes': - for ctrl in self.controls(): - if ctrl.print_time_timeout_id: - gobject.source_remove(ctrl.print_time_timeout_id) - ctrl.print_time_timeout_id = None - else: - for ctrl in self.controls(): - if not ctrl.print_time_timeout_id: - ctrl.print_time_timeout(None) - ctrl.print_time_timeout_id = gobject.timeout_add(300000, - ctrl.print_time_timeout, None) - def move_to_next_unread_tab(self, forward): ind = self.notebook.get_current_page() current = ind -- GitLab