[kupfer: 16/41] vim: Correctly unregister d-bus signal callback and finalize
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 16/41] vim: Correctly unregister d-bus signal callback and finalize
- Date: Tue, 26 Apr 2011 17:14:09 +0000 (UTC)
commit 71a158ab8ffa7fed6aa6672999b4ce3716b5e885
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Tue Apr 26 18:44:01 2011 +0200
vim: Correctly unregister d-bus signal callback and finalize
kupfer/plugin/vim/plugin.py | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/plugin/vim/plugin.py b/kupfer/plugin/vim/plugin.py
index eec4f11..3aba92c 100644
--- a/kupfer/plugin/vim/plugin.py
+++ b/kupfer/plugin/vim/plugin.py
@@ -343,17 +343,25 @@ class ActiveVim (Source):
def initialize(self):
self.serverids = []
+ self.signal_match = None
glib.timeout_add_seconds(1, self.start_helper)
def start_helper(self):
bus = dbus.Bus()
- bus.add_signal_receiver(self.on_new_serverlist,
+ self.signal_match = bus.add_signal_receiver(self.on_new_serverlist,
signal_name="NewServerlist",
dbus_interface=get_plugin_iface_name(PLUGID),
byte_arrays=True)
get_plugin_service_obj(PLUGID, activate=True)
def finalize(self):
+ if self.signal_match is not None:
+ bus = dbus.Bus()
+ bus.remove_signal_receiver(self.signal_match,
+ signal_name="NewServerlist",
+ dbus_interface=get_plugin_iface_name(PLUGID))
+ self.signal_match = None
+ self.mark_for_update()
stop_plugin_service(PLUGID)
def get_items(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]