Mercurial > pidgin
annotate finch/libgnt/pygnt/gnttree.override @ 22063:f808629a0123
Default for "do you want to add this buddy?" for oscar is now "no"
instead of "none"
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 11 Jan 2008 00:01:33 +0000 |
parents | 66001118617d |
children |
rev | line source |
---|---|
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
1 /** |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
2 * pygnt- Python bindings for the GNT toolkit. |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
3 * Copyright (C) 2007 Sadrul Habib Chowdhury <sadrul@pidgin.im> |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
4 * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
5 * gnttree.override: overrides for the tree widget. |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
6 * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
7 * This library is free software; you can redistribute it and/or |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
8 * modify it under the terms of the GNU Lesser General Public |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
9 * License as published by the Free Software Foundation; either |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
10 * version 2.1 of the License, or (at your option) any later version. |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
11 * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
12 * This library is distributed in the hope that it will be useful, |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
15 * Lesser General Public License for more details. |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
16 * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
17 * You should have received a copy of the GNU Lesser General Public |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
18 * License along with this library; if not, write to the Free Software |
19681
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18730
diff
changeset
|
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
20 * USA |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
21 */ |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
22 %% |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
23 headers |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
24 #include "common.h" |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
25 %% |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
26 ignore |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
27 gnt_tree_create_row |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
28 gnt_tree_create_row_from_list |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
29 %% |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
30 override gnt_tree_get_selection_text_list noargs |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
31 static PyObject * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
32 _wrap_gnt_tree_get_selection_text_list(PyGObject *self) |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
33 { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
34 GList *list = gnt_tree_get_selection_text_list(GNT_TREE(self->obj)); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
35 return create_pyobject_from_string_list(list); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
36 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
37 %% |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
38 override gnt_tree_get_rows noargs |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
39 static PyObject * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
40 _wrap_gnt_tree_get_rows(PyGObject *self) |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
41 { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
42 GList *list = gnt_tree_get_rows(GNT_TREE(self->obj)); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
43 PyObject *py_list; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
44 if (list == NULL) { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
45 Py_INCREF(Py_None); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
46 return Py_None; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
47 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
48 if ((py_list = PyList_New(0)) == NULL) { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
49 return NULL; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
50 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
51 while (list) { |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
52 PyObject *obj = list->data; |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
53 PyList_Append(py_list, obj); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
54 list = list->next; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
55 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
56 return py_list; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
57 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
58 %% |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
59 override gnt_tree_add_row_after |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
60 static PyObject * |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
61 _wrap_gnt_tree_add_row_after(PyGObject *self, PyObject *args) |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
62 { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
63 static char *kwlist[] = {"key", "row", "parent", "bigbro", NULL}; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
64 PyObject *py_list; |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
65 gpointer key, parent, bigbro = NULL; |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
66 int len, i; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
67 GList *list = NULL; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
68 GntTreeRow *row; |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
69 gboolean insert_last = FALSE; |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
70 |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
71 if (!PyArg_ParseTuple(args, |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
72 "OOO|O:GntTree.add_row_after", |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
73 &key, |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
74 &py_list, |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
75 &parent, |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
76 &bigbro)) |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
77 return NULL; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
78 |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
79 len = PySequence_Length(py_list); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
80 for (i = 0; i < len; i++) { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
81 PyObject *item = PySequence_GetItem(py_list, i); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
82 if (!pygobject_check(item, &PyString_Type)) { |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
83 PyErr_SetString(PyExc_TypeError, |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
84 "column_list members must be strings"); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
85 Py_DECREF(item); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
86 return NULL; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
87 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
88 list = g_list_prepend(list, PyString_AsString(item)); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
89 Py_DECREF(item); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
90 } |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
91 |
19764
80bfc233c9f2
Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
92 if (parent == Py_None) |
80bfc233c9f2
Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
93 parent = NULL; |
80bfc233c9f2
Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
94 if (bigbro == Py_None) |
80bfc233c9f2
Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
95 bigbro = NULL; |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
96 else if (bigbro == NULL) |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
97 insert_last = TRUE; |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
98 |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
99 Py_INCREF((PyObject*)key); |
19764
80bfc233c9f2
Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19681
diff
changeset
|
100 |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
101 list = g_list_reverse(list); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
102 row = gnt_tree_create_row_from_list(GNT_TREE(self->obj), list); |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
103 if (insert_last) |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
104 gnt_tree_add_row_last(GNT_TREE(self->obj), |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
105 key, row, parent); |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
106 else |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
107 gnt_tree_add_row_after(GNT_TREE(self->obj), |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
108 key, row, |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
109 parent, bigbro); |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
110 g_list_free(list); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
111 |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
112 Py_INCREF(Py_None); |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
113 return Py_None; |
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
114 } |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
115 %% |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
116 override gnt_tree_get_selection_data noargs |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
117 static PyObject * |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
118 _wrap_gnt_tree_get_selection_data(PyGObject *self) |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
119 { |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
120 PyObject *ret = gnt_tree_get_selection_data(GNT_TREE(self->obj)); |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
121 if (!ret) |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
122 ret = Py_None; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
123 Py_INCREF(ret); |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
124 return ret; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
125 } |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
126 %% |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
127 override gnt_tree_change_text |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
128 static PyObject * |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
129 _wrap_gnt_tree_change_text(PyGObject *self, PyObject *args, PyObject *kwargs) |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
130 { |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
131 static char *kwlist[] = { "key", "colno", "text", NULL }; |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
132 char *text; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
133 int colno; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
134 gpointer key; |
18556
5e1412f4e67a
Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff
changeset
|
135 |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
136 if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Ois:GntTree.change_text", kwlist, &key, &colno, &text)) |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
137 return NULL; |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
138 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
139 gnt_tree_change_text(GNT_TREE(self->obj), key, colno, text); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
140 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
141 Py_INCREF(Py_None); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
142 return Py_None; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
143 } |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
144 %% |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
145 override gnt_tree_set_row_flags |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
146 static PyObject * |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
147 _wrap_gnt_tree_set_row_flags(PyGObject *self, PyObject *args, PyObject *kwargs) |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
148 { |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
149 static char *kwlist[] = { "key", "flag", NULL }; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
150 int flag; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
151 gpointer key; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
152 |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
153 if (!PyArg_ParseTupleAndKeywords(args, kwargs,"Oi:GntTree.set_row_flags", kwlist, &key, &flag)) |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
154 return NULL; |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
155 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
156 gnt_tree_set_row_flags(GNT_TREE(self->obj), key, flag); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
157 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
158 Py_INCREF(Py_None); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
159 return Py_None; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
160 } |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
161 %% |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
162 override gnt_tree_remove |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
163 static PyObject * |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
164 _wrap_gnt_tree_remove(PyGObject *self, PyObject *args, PyObject *kwargs) |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
165 { |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
166 static char *kwlist[] = { "key", NULL }; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
167 gpointer key; |
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
168 |
18682
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
169 if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GntTree.remove", kwlist, &key)) |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
170 return NULL; |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
171 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
172 gnt_tree_remove(GNT_TREE(self->obj), key); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
173 |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
174 Py_INCREF(Py_None); |
254823d66aa5
The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18679
diff
changeset
|
175 return Py_None; |
18679
6b16fca71f8b
Add some more functions for GntTree. One point to note is that the key
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18556
diff
changeset
|
176 } |
18730
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
177 %% |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
178 override gnt_tree_set_selected |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
179 static PyObject * |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
180 _wrap_gnt_tree_set_selected(PyGObject *self, PyObject *args) |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
181 { |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
182 gpointer key; |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
183 if (!PyArg_ParseTuple(args, "O:GntTree.set_selected", &key)) { |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
184 return NULL; |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
185 } |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
186 gnt_tree_set_selected(GNT_TREE(self->obj), key); |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
187 Py_INCREF(Py_None); |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
188 return Py_None; |
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
189 } |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
190 %% |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
191 override gnt_tree_set_compare_func |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
192 static PyObject * |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
193 _wrap_gnt_tree_set_compare_func(PyGObject *self, PyObject *args) |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
194 { |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
195 static char *kwlist[] = {"compare_func", NULL}; |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
196 PyGObject *compare; |
18730
54a28e05e8af
Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
18682
diff
changeset
|
197 |
20711
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
198 if (!PyArg_ParseTuple(args, "O:GntTree.set_compare_func", &compare)) { |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
199 return NULL; |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
200 } |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
201 |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
202 if (!PyCallable_Check(compare)) { |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
203 PyErr_SetString(PyExc_TypeError, "the callback must be callable ... doh!"); |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
204 return NULL; |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
205 } |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
206 |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
207 Py_INCREF(compare); |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
208 gnt_tree_set_compare_func(GNT_TREE(self->obj), (GCompareFunc)compare->obj); |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
209 |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
210 Py_INCREF(Py_None); |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
211 return Py_None; |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
212 } |
66001118617d
Make the row-insertion a little more robust.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
19764
diff
changeset
|
213 |