From 81c0b528aed3d437b51dc877da747ce758c28e41 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Sun, 11 Mar 2007 08:58:08 +0000 Subject: [PATCH] give list of removed event to fire_event_removed func so that it transmits it to listeners --- src/common/events.py | 13 ++++++++----- src/systray.py | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/common/events.py b/src/common/events.py index 5d43efea7..b7dd852a1 100644 --- a/src/common/events.py +++ b/src/common/events.py @@ -74,9 +74,9 @@ class Events: for listener in self._event_added_listeners: listener(event) - def fire_event_removed(self): + def fire_event_removed(self, event_list): for listener in self._event_removed_listeners: - listener() + listener(event_list) def change_account_name(self, old_name, new_name): if self._events.has_key(old_name): @@ -122,26 +122,29 @@ class Events: del self._events[account][jid] else: self._events[account][jid].remove(event) - self.fire_event_deleted(event) + self.fire_event_removed([event]) return else: return True if types: new_list = [] # list of events to keep + removed_list = [] # list of removed events for ev in self._events[account][jid]: if ev.type_ not in types: new_list.append(ev) + else: + removed_list.append(ev) if len(new_list) == len(self._events[account][jid]): return True if new_list: self._events[account][jid] = new_list else: del self._events[account][jid] - self.fire_event_removed() + self.fire_event_removed(removed_list) return # no event nor type given, remove them all del self._events[account][jid] - self.fire_event_removed() + self.fire_event_removed(self._events[account][jid]) def change_jid(self, account, old_jid, new_jid): if not self._events[account].has_key(old_jid): diff --git a/src/systray.py b/src/systray.py index d010a5543..0ba839c85 100644 --- a/src/systray.py +++ b/src/systray.py @@ -74,7 +74,7 @@ class Systray: if event.show_in_systray: self.set_img() - def on_event_removed(self): + def on_event_removed(self, event_list): '''Called when one or more events are removed from the event list''' self.set_img()