From 1144ee802f159332577abfe78362fa1b3d9962de Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Wed, 24 Oct 2007 09:52:20 +0000 Subject: [PATCH] SignalReceiver now initializes gobject threading. --- deluge/ui/client.py | 2 +- deluge/ui/gtkui/signals.py | 3 ++- deluge/ui/signalreceiver.py | 8 ++++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 1d33055f5..07990221b 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -1,5 +1,5 @@ # -# functions.py +# client.py # # Copyright (C) 2007 Andrew Resch ('andar') # diff --git a/deluge/ui/gtkui/signals.py b/deluge/ui/gtkui/signals.py index bbf4d7dca..39759a369 100644 --- a/deluge/ui/gtkui/signals.py +++ b/deluge/ui/gtkui/signals.py @@ -47,7 +47,8 @@ class Signals(component.Component): self.receiver.connect_to_signal("torrent_removed", self.torrent_removed_signal) self.receiver.connect_to_signal("torrent_paused", self.torrent_paused) - self.receiver.connect_to_signal("torrent_resumed", self.torrent_resumed) + self.receiver.connect_to_signal("torrent_resumed", + self.torrent_resumed) self.receiver.connect_to_signal("torrent_all_paused", self.torrent_all_paused) self.receiver.connect_to_signal("torrent_all_resumed", diff --git a/deluge/ui/signalreceiver.py b/deluge/ui/signalreceiver.py index 1bec7f433..60f880830 100644 --- a/deluge/ui/signalreceiver.py +++ b/deluge/ui/signalreceiver.py @@ -32,6 +32,9 @@ # statement from all source files in the program, then also delete it here. import sys + +import gobject + import deluge.ui.client as client import deluge.SimpleXMLRPCServer as SimpleXMLRPCServer from SocketServer import ThreadingMixIn @@ -47,6 +50,7 @@ class SignalReceiver( def __init__(self, port): log.debug("SignalReceiver init..") + gobject.threads_init() threading.Thread.__init__(self) # Set to true so that the receiver thread will exit @@ -105,14 +109,14 @@ class SignalReceiver( if data != None: for callback in self.signals[signal]: try: - callback(data) + gobject.idle_add(callback, data) except: log.warning("Unable to call callback for signal %s", signal) else: for callback in self.signals[signal]: try: - callback() + gobject.idle_add(callback) except: log.warning("Unable to call callback for signal %s", signal)