Index: deskbar/applet.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/applet.py,v retrieving revision 1.18 diff -u -p -r1.18 applet.py --- deskbar/applet.py 14 Oct 2005 20:04:57 -0000 1.18 +++ deskbar/applet.py 15 Oct 2005 22:02:46 -0000 @@ -3,7 +3,7 @@ import deskbar, deskbar.deskbarentry, de from deskbar.module_list import ModuleLoader # WARNING: Load gnome.ui before gnomeapplet or we have a nasty warning. import gnome.ui -import gnomeapplet, gtk, gtk.gdk, gconf +import gnomeapplet, gtk, gtk.gdk, gconf, gobject from deskbar.module_list import ModuleList from deskbar.module_list import ModuleLoader @@ -14,7 +14,7 @@ class DeskbarApplet: self.loader = ModuleLoader (deskbar.MODULES_DIRS) self.loader.connect ("module-loaded", lambda l, mod: self.loader.initialize_module_async(mod)) - self.loader.load_all_async () + gobject.idle_add(self.loader.load_all_async) self.module_list = ModuleList () self.loader.connect ("module-loaded", self.module_list.update_row_cb) Index: deskbar/module_list.py =================================================================== RCS file: /cvs/gnome/deskbar-applet/deskbar/module_list.py,v retrieving revision 1.8 diff -u -p -r1.8 module_list.py --- deskbar/module_list.py 15 Oct 2005 13:53:12 -0000 1.8 +++ deskbar/module_list.py 15 Oct 2005 22:02:46 -0000 @@ -5,8 +5,9 @@ import sys import pydoc from os.path import join, basename, normpath, abspath from os.path import split, expanduser, exists, isfile, dirname -from threading import Thread -import Queue +#from threading import Thread +#import Queue +import gobject class ModuleContext: """A generic wrapper for any object stored in a ModuleList. @@ -251,19 +252,19 @@ class ModuleLoader (gobject.GObject): self.dirs = None self.filelist = [] - self.task_queue = Queue.Queue(0) - thread = Thread(None, self.consume_queue) + #self.task_queue = Queue.Queue(0) + #thread = Thread(None, self.consume_queue) # WE don't want the queue thread to prevent us from exiting - thread.setDaemon(True) - thread.start() + #thread.setDaemon(True) + #thread.start() - def consume_queue(self): - while True: - task = self.task_queue.get() - try: - task () - except Exception, msg: - print 'Error:consume_queue:Got an error while processing item:', msg + #def consume_queue(self): + # while True: + # task = self.task_queue.get() + # try: + # task () + # except Exception, msg: + # print 'Error:consume_queue:Got an error while processing item:', msg def build_filelist (self): """Returns a list containing the filenames of all qualified modules. @@ -391,25 +392,29 @@ class ModuleLoader (gobject.GObject): """ Same as load_all() except the loading is done in a separate thread. """ - self.task_queue.put(self.load_all) + #self.task_queue.put(self.load_all) + gobject.idle_add(self.load_all) def load_async (self, filename): """ Invokes load() in a new thread. """ - self.task_queue.put( lambda: self.load(filename) ) + #self.task_queue.put( lambda: self.load(filename) ) + gobject.idle_add(lambda: self.load(filename)) def initialize_module_async (self, context): """ Invokes initialize_module in a new thread. """ - self.task_queue.put( lambda: self.initialize_module(context) ) + #self.task_queue.put( lambda: self.initialize_module(context) ) + gobject.idle_add( lambda: self.initialize_module(context) ) def stop_module_async (self, context): """ Invokes stop_module in a new thread. """ - self.task_queue.put( lambda: self.stop_module(context) ) + #self.task_queue.put( lambda: self.stop_module(context) ) + gobject.idle_add( lambda: self.stop_module(context) ) def toggle_module (sender, context, ml): """Test function"""