From eaa11ed466f3814abd69ea48f965f434de236b27 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 26 Sep 2006 06:53:43 +0000 Subject: [PATCH] remove timeout in profile window. Fixes #1840 --- src/profile_window.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/profile_window.py b/src/profile_window.py index faf7274b8..badcbb310 100644 --- a/src/profile_window.py +++ b/src/profile_window.py @@ -73,6 +73,7 @@ class ProfileWindow: _('Retrieving profile...')) self.update_progressbar_timeout_id = gobject.timeout_add(100, self.update_progressbar) + self.remove_statusbar_timeout_id = None # Create Image for avatar button image = gtk.Image() @@ -84,7 +85,15 @@ class ProfileWindow: self.progressbar.pulse() return True # loop forever + def remove_statusbar(self, message_id): + self.statusbar.remove(self.context_id, message_id) + self.remove_statusbar_timeout_id = None + def on_profile_window_destroy(self, widget): + if self.update_progressbar_timeout_id is not None: + gobject.source_remove(self.update_progressbar_timeout_id) + if self.remove_statusbar_timeout_id is not None: + gobject.source_remove(self.remove_statusbar_timeout_id) del gajim.interface.instances[self.account]['profile'] def on_profile_window_key_press_event(self, widget, event): @@ -232,8 +241,8 @@ class ProfileWindow: self.statusbar.remove(self.context_id, self.message_id) self.message_id = self.statusbar.push(self.context_id, _('Information received')) - gobject.timeout_add(3000, self.statusbar.remove, self.context_id, - self.message_id) + self.remove_statusbar_timeout_id = gobject.timeout_add(3000, + self.remove_statusbar, self.message_id) gobject.source_remove(self.update_progressbar_timeout_id) # redraw progressbar after avatar is set so that windows is already # resized. Else progressbar is not correctly redrawn @@ -322,8 +331,8 @@ class ProfileWindow: self.statusbar.remove(self.context_id, self.message_id) self.message_id = self.statusbar.push(self.context_id, _('Information published')) - gobject.timeout_add(3000, self.statusbar.remove, self.context_id, - self.message_id) + self.remove_statusbar_timeout_id = gobject.timeout_add(3000, + self.remove_statusbar, self.message_id) if self.update_progressbar_timeout_id is not None: gobject.source_remove(self.update_progressbar_timeout_id) self.progressbar.set_fraction(0) @@ -334,8 +343,8 @@ class ProfileWindow: self.statusbar.remove(self.context_id, self.message_id) self.message_id = self.statusbar.push(self.context_id, _('Information NOT published')) - gobject.timeout_add(3000, self.statusbar.remove. self.context_id, - self.message_id) + self.remove_statusbar_timeout_id = gobject.timeout_add(3000, + self.remove_statusbar, self.message_id) if self.update_progressbar_timeout_id is not None: gobject.source_remove(self.update_progressbar_timeout_id) self.progressbar.set_fraction(0)