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



thanks Jonathan for the reply,

 Re "Such as?" - an example is my alternative-toolbar plugin where some parts of the GUI are not available to be modified until the database has been loaded - i.e.. I'm fiddling with what parts of the source-toolbar should be shown.  Coverart Browser has similar requirements to add to the interface once the database has been loaded.

The suggestion to look at the playlists property looks good.  Also looking at the "selected_page" property on the shell seems to also work for what I want.

thanks again - very useful advice.

On 26 July 2015 at 10:34, Jonathan Matthew <jonathan d14n org> wrote:
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]