diff options
Diffstat (limited to 'plugins/pychrysa/quirks.c')
-rw-r--r-- | plugins/pychrysa/quirks.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/plugins/pychrysa/quirks.c b/plugins/pychrysa/quirks.c index bd60925..68f0a2e 100644 --- a/plugins/pychrysa/quirks.c +++ b/plugins/pychrysa/quirks.c @@ -46,6 +46,8 @@ typedef struct _PyGObjectData_fake /* Clef d'accès réservée */ static GQuark pygobject_instance_data_key_fake = 0; +/* Clef pour l'enregistrement de l'objet Python dans l'objet GLib */ +static GQuark pygobject_wrapper_key_fake = 0; @@ -113,6 +115,7 @@ static GObject *_ref = NULL; void pychrysalide_init_quirks(void) { pygobject_instance_data_key_fake = g_quark_from_static_string("PyGObject::instance-data"); + pygobject_wrapper_key_fake = g_quark_from_static_string("PyGObject::wrapper"); } @@ -153,6 +156,32 @@ void pychrysalide_set_instance_data(GObject *obj, PyTypeObject *type) /****************************************************************************** * * +* Paramètres : obj = instance existante GLib. * +* * +* Description : Fournit l'instance Python d'une instance GLib, si existante. * +* * +* Retour : Instance Python mise en place ou NULL. * +* * +* Remarques : Les retours non nuls voient leur compteur incrémenté. * +* * +******************************************************************************/ + +PyObject *pychrysalide_get_pygobject(GObject *obj) +{ + PyObject *result; /* Objet en place à renvoyer */ + + result = (PyObject *)g_object_get_qdata(obj, pygobject_wrapper_key_fake); + + if (result != NULL) + Py_INCREF(result); + + return result; + +} + + +/****************************************************************************** +* * * Paramètres : self = objet à initialiser (théoriquement). * * args = arguments fournis à l'appel. * * kwds = arguments de type key=val fournis. * |