Re: [gDesklets] events in controls

Johan van der Slikke wrote:
> Hi!
> I'm developing a desklets to monitor my laptop battery. So I
> started with writing an control to provide the information to the
> desklet. I'm asking the info from HAL via dbus. To let HAL notify
> me of changes (i.e. an connected power cable) I would normally
> start a loop with:
> self.__ac_obj.connect_to_signal ("PropertyModified",
> self.__property_modified)
> self.__batt_obj.connect_to_signal
> ("PropertyModified", self.__property_modified)
> self.__loop = gobject.MainLoop()
> But this seems to mess up gdesklets: I can only get it working
> again with killing python and start gdesklets again.

I think the main problem is that you don't need to run a main loop (so
you can get rid of both references to self.__loop).  You could either
call connect_to_signal() in __init__() or in the function that gets
called whenever a property gets set.  It looks like you might want to
do this in __init__() if you're going to go with the method you have
laid out above.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]