Re: [Rhythmbox-devel] Generating Python Bindings

On Wed, Mar 24, 2010 at 2:05 AM, Huntly Cameron
<huntly cameron gmail com> wrote:
> Hi,
> I'm very much new to open-source development and rhytmbox development
> in particular, so please bear with me :-)
> Basically I'm writing a plugin that will allow a user to sync their
> podcast feeds to ubuntu-one (at the moment with a view to add other
> remote sources as I go on).  And I'm pretty much finished with the
> bulk of the code.  The only thing I need to do is to have it so that
> when new podcast feeds are added and committed from the remote source,
> tell rhythmbox to update the feeds.

Sounds pretty interesting. I'm idly thinking about ways we can use
services like this to back up user data and share it between machines,
so it's good to see people actually working in it too.

> From the documentation I see that I would need to use the
> rb-podcast-manager class which does not at the moment, have python
> bindings.  Moch on IRC suggested I added this class to the bindings.
> I would very much like to have a go at this, but, not coming from a
> c/c++ background I'm pretty much diving in head first and could use
> some pointers on how to do this.

I should probably write this up on the wiki. Maybe even before the
bindings start vaguely approaching being complete..

> From a previous post to this list and looking around at the source I
> think I've figured out that I need to do:
> 1. Add the associated header file to the "BINDING_HEADERS_SRCEDIR_IN"
> variable in the in bindings/python

BINDING_HEADERS_SRCDIR_IN is only used to generate a rough first
version of the bindings by running 'make regenerate-python-binding'.
The generated bindings are in about the right shape, but a lot of
details will be wrong. You then find the bits in
that relate to the classes you've changed or added and copy them in to
rb.defs wherever it looks like they fit. You may also need to add
header #includes to rb.overrides.

> 2. Map the header file in the rb.defs file in bindings/python
> 3. and generate the code somehow.
> This last step I'm unsure about: do i just run "pygobject-codegen-2.0"
> in the bindings/python dir?

Just run 'make'. It may not be able to generate code for some of the
methods, and it'll usually tell you why. When this happens, you can
either 1) give up, or 2) add custom bindings code to rb.overrides.
Option 2 is not much fun.

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