Re: [Rhythmbox-devel] RB.Source.add_to_queue() argument 1 must be rb.Source, not str

On Fri, Apr 8, 2011 at 4:29 PM, Lachlan d <lachlan 00 gmail com> wrote:
> i'm stuck at add_to_queue(), i get the uri and then it tells me that's
> wrong, how am i supposed to add to the play queue?

Get the play queue source (via the 'queue-source' property on the
shell) and add entries to it directly with the add_entry method.
rb_shell_add_to_queue is going to disappear shortly, since it's part
of the shell dbus interface, which is going to be removed entirely.

> On the writing guide it just shows the URI and that's what i've given
> it, but it doesn't want it as a string?
> shell.add_to_queue(location)
> TypeError: RB.Source.add_to_queue() argument 1 must be rb.Source, not str
>    def event_handler(self, shell, event, data=None):
>        if event.type != gtk.gdk.BUTTON_RELEASE or event.button != 2:
>            return False
>        source = shell.get_property("selected_page")
>        entry = rb.Source.get_entry_view(source)
>        selection = entry.get_selected_entries()
>        for items in selection:
>            location = items.get_playback_uri()
>            shell.add_to_queue(location)

Strange, it's trying to invoke the RBSource add_to_queue method rather
than the RBShell method. Are you sure 'shell' is actually the RBShell
object here?

Anyway, this should look roughly like this:

   source = shell.props.selected_page
   queue = shell.props.queue_source
   entryview = source.get_entry_view()
   if entryview:
       for e in entryview.get_selected_entries():
           queue.add_entry(e, -1)

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