annotate finch/libgnt/pygnt/gnttree.override @ 20096:2a9f3a499b0d

merge of '34d642b12b7215d55fd032cd513a7e225715f19a' and '7868c3b2b7d17c52916e4bb76305b7e3b68d3904'
author Richard Laager <rlaager@wiktel.com>
date Mon, 17 Sep 2007 03:47:45 +0000
parents 80bfc233c9f2
children 66001118617d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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;
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
65 gpointer key, 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
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;
5e1412f4e67a Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
69
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 if (!PyArg_ParseTuple(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
71 "OOOO:GntTree.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
72 &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
73 &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
74 &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
75 &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
76 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
77
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 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
79 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
80 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
81 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
82 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
83 "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
84 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
85 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
86 }
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 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
88 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
89 }
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
19764
80bfc233c9f2 Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
91 if (parent == Py_None)
80bfc233c9f2 Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
92 parent = NULL;
80bfc233c9f2 Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
93 if (bigbro == Py_None)
80bfc233c9f2 Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
94 bigbro = NULL;
80bfc233c9f2 Fix a memory corruption.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19681
diff changeset
95
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
96 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
97 row = gnt_tree_create_row_from_list(GNT_TREE(self->obj), 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
98 gnt_tree_add_row_after(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
99 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
100 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
101 parent, 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
102 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
103
5e1412f4e67a Do some work to make pygnt more useful. The dbus-gnt script works fairly
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
diff changeset
104 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
105 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
106 }
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
107 %%
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
108 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
109 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
110 _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
111 {
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
112 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
113 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
114 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
115 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
116 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
117 }
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 %%
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 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
120 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
121 _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
122 {
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
123 static char *kwlist[] = { "key", "colno", "text", NULL };
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
124 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
125 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
126 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
127
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
128 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
129 return NULL;
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
130
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
131 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
132
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
133 Py_INCREF(Py_None);
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
134 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
135 }
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
136 %%
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
137 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
138 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
139 _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
140 {
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
141 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
142 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
143 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
144
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
145 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
146 return NULL;
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
147
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
148 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
149
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
150 Py_INCREF(Py_None);
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
151 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
152 }
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
153 %%
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
154 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
155 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
156 _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
157 {
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
158 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
159 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
160
18682
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
161 if (!PyArg_ParseTupleAndKeywords(args, kwargs,"O:GntTree.remove", kwlist, &key))
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
162 return NULL;
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
163
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
164 gnt_tree_remove(GNT_TREE(self->obj), key);
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
165
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
166 Py_INCREF(Py_None);
254823d66aa5 The promised cleanups.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18679
diff changeset
167 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
168 }
18730
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
169 %%
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
170 override gnt_tree_set_selected
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
171 static PyObject *
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
172 _wrap_gnt_tree_set_selected(PyGObject *self, PyObject *args)
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
173 {
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
174 gpointer key;
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
175 if (!PyArg_ParseTuple(args, "O:GntTree.set_selected", &key)) {
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
176 return NULL;
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 gnt_tree_set_selected(GNT_TREE(self->obj), key);
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
179 Py_INCREF(Py_None);
54a28e05e8af Export another tree function.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 18682
diff changeset
180 return Py_None;
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