[Thunar-dev] Need help with thunarx-python bindings issue

Adam Plumb adamplumb at gmail.com
Sun Dec 13 17:19:12 CET 2009


Hallelujah!  After days of agony and frustration I finally figured this out.

I'm using the pygobject h2def.py script to generate my .defs file from the
thunarx header files, and for all my object definitions (i.e.
ThunarxMenuProvider, etc), it was using the define-object call.  But
apparently, it needs to use the define-interface call, because once I
changed it to define-interface, everything worked perfectly.  I only noticed
this after looking at the nautilus-python's generated nautilus.c file, which
was calling pyg_register_interface() rather than the
pygobject_register_class() function all my objects were using.  I then
looked at the nautilus defs file and it was using the define-interface call
rather than the define-object call.  Changing "object" to "interface" fixed
it for me.

I sent a similar message to the pygtk mailing list, hopefully they'll be
able to explain to me why the h2def.py file made that decision.

Adam

On Fri, Dec 11, 2009 at 11:07 AM, Adam Plumb <adamplumb at gmail.com> wrote:

> hi all, I'm working on creating python bindings for the thunar extension
> framework.  The code is mainly based on the nautilus-python bindings, and I
> also took some configure.ac and Makefile.am code from the
> thunar-vcs-plugin project and others.
>
> I've got the basic code compiling and running, but I'm running into an
> issue in the get_(folder|file)_actions functions with converting a
> ThunarxFileInfo object into a PyObject to pass to the python extension.
> When I run the pygobject_new() function on the GtkWidget window object, it
> works fine.  But when I run pygobject_new on the ThunarxFileInfo object, I
> get the following error:
>
> TypeError: multiple bases have instance lay-out conflict
> **
> ERROR:/build/buildd/pygobject-2.18.0/gobject/pygobject.c:924:pygobject_new_full:
> assertion failed: (tp != NULL)
> Aborted
>
> I'm pretty new to python bindings, c code, thunar, and pretty much
> everything, and I'm learning as I go, so I was hoping someone here would
> take an interest and look at the code and see if they can find anything I'm
> doing wrong.
>
> The project is available at: http://github.com/adamplumb/thunarx-python
> The code in question is at:
> http://github.com/adamplumb/thunarx-python/blob/master/src/thunarx-python-object.c#L147
>
> The code is written for thunar master, and requires thunarx-2.
>
> Thanks,
> Adam
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.xfce.org/pipermail/thunar-dev/attachments/20091213/7093be93/attachment.html>


More information about the Thunar-dev mailing list