Make use of GObject introspection

Bug #609352 reported by Mathias Brodala
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Exaile
Confirmed
Wishlist
Unassigned

Bug Description

Instead of relying on bindings, GObject introspection (http://live.gnome.org/GObjectIntrospection) through PyGi (http://live.gnome.org/PyGI) should be used. This gets rid of overhead and will allow us to always use the latest API provided by GLib/GObject/Gtk.

By then, dependency on python-* should be changed to (unversioned?) dependencies on gir* and probably versioned dependencies on GLib/GObject/Gtk which is overdue anyways.

Simple example for migration:

import gio
import gtk
import pango

Becomes:

from gi.repository import (
    Gio as gio,
    Gtk as gtk,
    Pango as pango
)

Mathias Brodala (mathbr)
description: updated
Revision history for this message
Mathias Brodala (mathbr) wrote :

Small test case showcasing Gobject introspection usage and some of the later features introduced in GTK (action widgets in GtkNotebook, GtkSpinner).

Some notable issues required to be resolved in Gobject introspection itself before we can consider using it:

* No default values in e.g. GtkBox.pack_start()
* Loss of convenience wrappers like GtkTreeRow[0][0] for simple value access, __gproperties__, __gsignals__, …

Revision history for this message
Johannes Sasongko (sjohannes) wrote : Re: [Bug 609352] Re: Make use of GObject introspection

> * Loss of convenience wrappers like GtkTreeRow[0][0] for simple value access, __gproperties__, __gsignals__, …

As PyGi is now part of PyGObject, I wonder if they haven't provided
similar helpers.

Here is a pygtk-to-pygi converter that we can partly use:
http://git.gnome.org/browse/pygobject/tree/pygi-convert.sh

Revision history for this message
Mathias Brodala (mathbr) wrote :

Correction: __gproperties__ and __gsignals__ seem to work very well with introspection. Leaves only the GtkTreeModelRow accessor.

Revision history for this message
Johannes Sasongko (sjohannes) wrote :

Just a status report, in case anyone is wondering: We're waiting for PyGI to become more accepted and stable in the various distributions.

We've also found a PyGI bug that will certainly block our implementation (can't populate the TargetEntry struct needed for DnD): https://bugzilla.gnome.org/show_bug.cgi?id=627367

By the way, I think a good strategy is to convert our D-Bus interface first, to test the water. That way, users that don't have (Py)GI can still at least run exaile with --no-dbus.

Revision history for this message
Johannes Sasongko (sjohannes) wrote :

More status updates:
- The actual bug regarding TargetEntry is [1], marked fixed.
- So far I haven't been able to get D-Bus working with GI.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=632095

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.