summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/glibext
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/pychrysalide/glibext')
-rw-r--r--plugins/pychrysalide/glibext/configuration.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/plugins/pychrysalide/glibext/configuration.c b/plugins/pychrysalide/glibext/configuration.c
index 235662d..b0586af 100644
--- a/plugins/pychrysalide/glibext/configuration.c
+++ b/plugins/pychrysalide/glibext/configuration.c
@@ -856,10 +856,8 @@ static PyObject *py_config_param_iterator_next(PyObject *self)
iterator->last = item;
if (item != NULL)
- {
result = pygobject_new(G_OBJECT(item->data));
- Py_INCREF(result);
- }
+
else
{
PyErr_SetNone(PyExc_StopIteration);
@@ -1098,7 +1096,7 @@ static int py_generic_config_init(PyObject *self, PyObject *args, PyObject *kwds
name = NULL;
- ret = PyArg_ParseTuple(args, "s", &name);
+ ret = PyArg_ParseTuple(args, "|s", &name);
if (!ret) return -1;
/* Initialisation d'un objet GLib */
@@ -1110,7 +1108,8 @@ static int py_generic_config_init(PyObject *self, PyObject *args, PyObject *kwds
config = G_GEN_CONFIG(pygobject_get(self));
- g_generic_config_build(config, name);
+ if (name != NULL)
+ g_generic_config_build(config, name);
return 0;
@@ -1305,7 +1304,7 @@ static PyObject *py_generic_config_search(PyObject *self, PyObject *args)
else
{
result = pygobject_new(G_OBJECT(param));
- //g_object_unref(G_OBJECT(param));
+ g_object_unref(G_OBJECT(param));
}
return result;
@@ -1333,7 +1332,7 @@ static PyObject *py_generic_config_add(PyObject *self, PyObject *args)
GCfgParam *param; /* Paramètre GLib transmis */
int ret; /* Bilan de lecture des args. */
GGenConfig *config; /* Version GLib de la config. */
- GCfgParam *added; /* Elément ajouté ou NULL */
+ bool status; /* Bilan de l'opération */
#define GENERIC_CONFIG_ADD_METHOD PYTHON_METHOD_DEF \
( \
@@ -1361,19 +1360,10 @@ static PyObject *py_generic_config_add(PyObject *self, PyObject *args)
config = G_GEN_CONFIG(pygobject_get(self));
- g_object_ref(G_OBJECT(param));
- added = _g_generic_config_add_param(config, param, lock);
+ status = _g_generic_config_add_param(config, param, lock);
- if (added == NULL)
- {
- result = Py_None;
- Py_INCREF(result);
- }
- else
- {
- result = pygobject_new(G_OBJECT(added));
- //g_object_unref(G_OBJECT(added));
- }
+ result = status ? Py_True : Py_False;
+ Py_INCREF(result);
return result;
@@ -1436,6 +1426,7 @@ static PyObject *py_generic_config_delete(PyObject *self, PyObject *args)
static PyObject *py_generic_config_get_filename(PyObject *self, void *closure)
{
+ PyObject *result; /* Chemin à retourner */
GGenConfig *config; /* Version GLib de la config. */
const char *filename; /* Chemin d'accès au fichier */
@@ -1446,14 +1437,23 @@ static PyObject *py_generic_config_get_filename(PyObject *self, void *closure)
" configuration.\n" \
"\n" \
"The result is a string pointing to a file which may not" \
- " (yet) exist." \
+ " (yet) exist or None if not defined." \
)
config = G_GEN_CONFIG(pygobject_get(self));
filename = g_generic_config_get_filename(config);
- return PyUnicode_FromString(filename);
+ if (filename == NULL)
+ {
+ result = Py_None;
+ Py_INCREF(result);
+ }
+
+ else
+ result = PyUnicode_FromString(filename);
+
+ return result;
}