finch/libgnt/pygnt/common.c

Tue, 17 Jul 2007 11:09:03 +0000

author
Sadrul Habib Chowdhury <sadrul@pidgin.im>
date
Tue, 17 Jul 2007 11:09:03 +0000
changeset 18826
a276583c694c
permissions
-rw-r--r--

Do some work to make pygnt more useful. The dbus-gnt script works fairly
well now.

18826
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
1 #include "common.h"
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
2
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
3 PyObject *
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
4 create_pyobject_from_string_list(GList *list)
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
5 {
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
6 PyObject *py_list;
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
7 if (list == NULL) {
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
8 Py_INCREF(Py_None);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
9 return Py_None;
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
10 }
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
11 if ((py_list = PyList_New(0)) == NULL) {
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
12 g_list_foreach(list, (GFunc)g_free, NULL);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
13 g_list_free(list);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
14 return NULL;
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
15 }
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
16 while (list) {
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
17 PyObject *obj = PyString_FromString(list->data);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
18 PyList_Append(py_list, obj);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
19 Py_DECREF(obj);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
20 g_free(list->data);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
21 list = g_list_delete_link(list, list);
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
22 }
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
23 return py_list;
a276583c694c Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
diff changeset
24 }

mercurial