A get_subtree method seemed natural for GtkTreeItem. A small patch to this
effect. Haven't checked it thoroughly, but it seems to work. Let me know
if it is broken.

Patch is made against python-gnome-1.0.2 from Debian sources. Should be
pygtk0.6.0, I think.

Anders "Quest" Qvist
NetGuide Scandinavia

-- Why suffer scarcity? Look for the Open Source and enter a world of plenty!
diff -u python-gnome-1.0.2.orig/pygtk/gtk.py ../python-gnome-1.0.2.orig/pygtk/gtk.py
--- python-gnome-1.0.2.orig/pygtk/gtk.py        Sun Apr 25 02:43:16 1999
+++ ../python-gnome-1.0.2.orig/pygtk/gtk.py     Sat May 29 12:04:27 1999
@@ -754,6 +754,8 @@
                        self._o = _gtk.gtk_tree_item_new_with_label(label)
        def set_subtree(self, subtree):
                _gtk.gtk_tree_item_set_subtree(self._o, subtree._o)
+       def get_subtree(self):
+               return _obj2inst(_gtk.gtk_tree_item_get_subtree(self._o))
        def select(self, obj=None):
                _gtk.gtk_tree_item_select(self._o)
        def deselect(self, obj=None):
diff -u python-gnome-1.0.2.orig/pygtk/gtkmodule.c 
../python-gnome-1.0.2.orig/pygtk/gtkmodule.c
--- python-gnome-1.0.2.orig/pygtk/gtkmodule.c   Sun Apr 25 02:42:15 1999
+++ ../python-gnome-1.0.2.orig/pygtk/gtkmodule.c        Sat May 29 12:36:36 1999
@@ -5186,6 +5186,20 @@
     return ret;
 }
 
+static PyObject *_wrap_gtk_tree_item_get_subtree(PyObject *self, PyObject *args)
+ {
+    PyObject *tree_item, *subtree;
+
+    if (!PyArg_ParseTuple(args, "O!:gtk_tree_item_get_subtree", &PyGtk_Type, 
+&tree_item))
+        return NULL;
+    subtree = GTK_TREE_ITEM_SUBTREE(GTK_TREE_ITEM(PyGtk_Get(tree_item)));
+    if (subtree != NULL)
+      return PyGtk_New((GtkObject *)subtree);
+    else
+      return Py_None;
+}
+
+
 static PyObject *_wrap_gtk_calendar_get_date(PyObject *self, PyObject *args) {
   PyObject *cal;
   guint year, month, day;
@@ -5658,6 +5672,7 @@
     { "gtk_list_remove_items", _wrap_gtk_list_remove_items, 1 },
     { "gtk_list_get_selection", _wrap_gtk_list_get_selection, 1 },
     { "gtk_tree_remove_items", _wrap_gtk_tree_remove_items, 1 },
+    { "gtk_tree_item_get_subtree", _wrap_gtk_tree_item_get_subtree, 1 },
     { "gtk_tree_get_selection", _wrap_gtk_tree_get_selection, 1 },
     { "gtk_calendar_get_date", _wrap_gtk_calendar_get_date, 1 },
     { "gtk_notebook_query_tab_label_packing", 
_wrap_gtk_notebook_query_tab_label_packing, 1 },

Reply via email to