Re: [Rhythmbox-devel] better way to detect when rhythmbox has started?



On Sat, May 23, 2015 at 10:56:34AM +0100, David Mohammed wrote:
Several of my plugins need to perform some processing after rhythmbox has
fully started up (i.e. the database has been fully loaded).

Such as?


Currently I'm using the load-complete signal  on RB.RhythmDB.

However - the obvious issue is that when a user first activates a plugin,
the load-complete signal has long ago been fired.

Thus I'm using a hack - wait for 3 seconds and if load-complete has not
been detected, then do the processing anyway.

Thus to my question - is there a better way to detect when rhythmbox has
started?

I'm a bit reluctant to call this a better way, but once the database is loaded,
the display page group for playlists is also set to loaded.  Since that's a gobject
property on something you can easily find (RB_DISPLAY_PAGE_GROUP_PLAYLISTS from c,
RB.DisplayPageGroup.get_by_id("playlists") in python, probably) you can use that as
a proxy for determining whether the database is loaded.


i.e. some kind of property that maybe I can regulary poll for to see if it
has been set post load-complete?

Properly implemented GObject properties also emit a notify::propertyname signal
on the containing object when they're changed, so you don't need to poll.



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