GNOME Bugzilla – Bug 551290
Add gobject-introspection support
Last modified: 2010-06-30 18:30:06 UTC
Hi, I was looking at turning gobject-introspection on totem. As part of that work I needed to break totem's core into a shared library, so that at build time the scanner can load it and call the _get_type() functions. This patch *almost* works but for some oddity with the existing Python support; it can't find some of those get_type functions and I don't know why.
Created attachment 118256 [details] [review] create internal noinst libtool library
Would that be used to create plugins in other languages easily? Or am I missing something? BTW, did you forget main.c in the patch?
Yeah, with this we should be able to eliminate the current internal vala and python binding infrastructure.
Created attachment 118262 [details] [review] main.c, goes with previous patch
Just the bindings, or the plugins code specifically for Python and Vala altogether?
Also, you define HAVE_INTROSPECTION, but never use it?
We should be able to get rid of the bindings/ directory, but not the code to load the Python interpreter. HAVE_INTROSPECTION is going to be used once the system works to load the Totem.typelib file. We will be able to add a bit of Automake like this: http://svn.gnome.org/svn/hippo-canvas/trunk/Makefile-introspection.am Then we call g_irepository_require_private (NULL, "totem", "Totem", 0, &error) and after that Python code, using pybank, running in the process will be able to access all the functions in Totem without having to add them to the .defs files.
That looks fine to me, although I wonder where you have the prototypes for totem_video_widget_create() for example (those should be in totem-private.h). You can commit to trunk if it still builds as expected.
Worked on this a little bit more; after talking to Owen we figured out that it's actually harder than this; if we want to avoid building all of Totem twice (once with -fPIC and once without) we need to basically have the introspection process go through the executable. Going to try that, marking the patch as rejected.
Note that the core of Totem's now been separated into a noinst library anyway, so that we can do gtk-doc API documentation.
Could you make the core of Totem be a shared library? 'cause on Windows, you can't build a dll (that's the format for the plugins) with unresolved symbols.
There's no way to use noinst libraries when building for Windows?
(In reply to comment #12) > There's no way to use noinst libraries when building for Windows? This is the same problem Rhythmbox had when Jonathan tried to port to Windows, you can't have symbols in the library that'll only resolve at run-time. So if the plugin calls into totem_do_foo, this function needs to exist in the plugin itself, or in a library it'll link to, not in the binary itself. This should be easy to fix. Shixin, could you please file a new bug?
(In reply to comment #13) > (In reply to comment #12) > > There's no way to use noinst libraries when building for Windows? > > This is the same problem Rhythmbox had when Jonathan tried to port to Windows, > you can't have symbols in the library that'll only resolve at run-time. So if > the plugin calls into totem_do_foo, this function needs to exist in the plugin > itself, or in a library it'll link to, not in the binary itself. > > This should be easy to fix. Shixin, could you please file a new bug? > filed as: http://bugzilla.gnome.org/show_bug.cgi?id=572713
Done in http://git.gnome.org/browse/totem/log/?h=introspection.
commit 92ae2c5426274ac39fc93748b81c38e03c8e8674 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sat Jun 26 22:54:59 2010 +0100 Bug 551290 — Add gobject-introspection support Add gobject-introspection support to libtotem.la. For the time being, we're introspecting only the files which exposed API which was previously used by the Python bindings. This adds a hard dependency on gobject-introspection 0.6.7, as the introspection will be necessary for Python and Vala plugin support. Closes: bgo#551290 Makefile.am | 3 +-- configure.in | 1 + src/Makefile.am | 51 ++++++++++++++++++++++++++++++++++++++++++++------- 3 files changed, 46 insertions(+), 9 deletions(-) commit 418c93a910536cc679661b8c411a5dd2493f9d8b Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sat Jun 26 22:53:04 2010 +0100 Fix nicknames for enum values src/totem-object.c | 62 ++++++++++++++++++++++++++-------------------------- 1 files changed, 31 insertions(+), 31 deletions(-) commit 723cf28b588a1f7705ebdc21d9b6e5438bfeba96 Author: Philip Withnall <philip@tecnocode.co.uk> Date: Sat Jun 26 22:02:37 2010 +0100 Move TotemDiscMediaType get_type() and quark() functions to totem-pl-parser The enum lives there, so the type functions should do too. docs/reference/totem-sections.txt | 4 ---- src/totem-object.c | 31 ------------------------------- src/totem.h | 5 ----- 3 files changed, 0 insertions(+), 40 deletions(-)