Commit 39fd0a85 authored by John (J5) Palmieri's avatar John (J5) Palmieri

fix up treeiter usage due to caller-allocates annotations in gtk+

* we still don't pass tests because the caller-allocates code path does not
  handle the case where the parameter is followed by a regular in parameter
parent 4d970b75
......@@ -353,8 +353,7 @@ class ListStore(Gtk.ListStore, TreeModel):
self.set_column_types(column_types)
def append(self, row):
treeiter = Gtk.TreeIter()
Gtk.ListStore.append(self, treeiter)
treeiter = Gtk.ListStore.append(self)
n_columns = self.get_n_columns();
if len(row) != n_columns:
......@@ -376,8 +375,8 @@ class TreeStore(Gtk.TreeStore, TreeModel):
self.set_column_types(column_types)
def append(self, parent, row):
treeiter = Gtk.TreeIter()
Gtk.TreeStore.append(self, treeiter, parent)
treeiter = Gtk.TreeStore.append(self, parent)
n_columns = self.get_n_columns();
if len(row) != n_columns:
......
......@@ -187,16 +187,18 @@ class TestGtk(unittest.TestCase):
self.assertEquals(len(tree_store), 100)
# walk the tree to see if the values were stored correctly
iter = Gtk.TreeIter()
parent = None
i = 0
while tree_store.iter_children(iter, parent):
(has_children, treeiter) = tree_store.iter_children(parent)
while (has_children):
i = tree_store.get_value(iter, 0)
s = tree_store.get_value(iter, 1)
obj = tree_store.get_value(iter, 2)
obj.check(i, s)
parent = iter
iter = Gtk.TreeIter()
parent = treeiter
(has_children, treeiter) = tree_store.iter_children(parent)
self.assertEquals(i, 99)
......@@ -211,15 +213,14 @@ class TestGtk(unittest.TestCase):
self.assertEquals(len(list_store), 100)
# walk the list to see if the values were stored correctly
iter = Gtk.TreeIter()
i = 0
has_more = list_store.get_iter_first(iter)
(has_more, treeiter) = list_store.get_iter_first()
while has_more:
i = list_store.get_value(iter, 0)
s = list_store.get_value(iter, 1)
obj = list_store.get_value(iter, 2)
i = list_store.get_value(treeiter, 0)
s = list_store.get_value(treeiter, 1)
obj = list_store.get_value(treeiter, 2)
obj.check(i, s)
has_more = list_store.iter_next(iter)
(has_more, treeiter) = list_store.iter_next()
self.assertEquals(i, 99)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment