Re: [Rhythmbox-devel] Populating source list...



Jonathan Matthew wrote:
On 11/3/07, Robert Connolly <rob_connolly mailshack com> wrote:
Hi all,

I'm trying to add entries to the list in a browser source. This is what
I have so far:

db = self.shell.props.db
entry_type = db.entry_register_type("NJB:List_Entry")
entry = db.entry_new(entry_type, "njb://song/%i" % count)
# set properties
db.set(entry, rhythmdb.PROP_TITLE, tag.GetStringValue())
# ... set rest of properties
db.commit()

That seems to work, I don't get any errors, but nothing shows up in the
Browser listing.

You need to use the entry type you pass to the source's constructor.
The browser source class, of which your source is a subclass, creates
query models (which select entries to be displayed in the source)
using the source's entry type property.
Thanks, that works. Makes sense too, it just never occurred to me!
Also, you probably want to include something unique to the device in
the entry URI, otherwise you won't be able to handle multiple devices
at the same time
Thanks I'll bear that in mind. How exactly does the URI relate to the song? Is it just ued as a unique identifier?

Thanks for your help.

Cheers,

Rob



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