GNOME Bugzilla – Bug 631548
Gtk.TreeStore.append() is counter-intuitive
Last modified: 2010-10-11 14:09:35 UTC
Here's the C API: void gtk_tree_store_append (GtkTreeStore *tree_store, GtkTreeIter *iter, GtkTreeIter *parent); It will append an iter to tree_store and set it in the iter variable. It does nothing else. Now, GtkTreeStore.append() works another way (it's overridden): model.append(parent, row) where row is a tuple containing the values for each column. A few things are wrong here: + it forces me to make sure that the row tuple will always have the values for the columns in the right order. Usually, I have no real interest in the order of my columns and I use variables like COLUMN_NAME = 0, COLUMN_ICON = 1, etc. + the C and the python API don't work the same way, and the user will assume they will since they have the same name. I think the python API provided here is useful, but it should come with another name.
I thought I modelled this after the Python API: http://library.gnome.org/devel/pygtk/stable/class-gtktreestore.html#method-gtktreestore--append
The main difference is that you can skip row in pygtk, which gives you an API that looks like the C API. Should be trivial to do too, actually.
Created attachment 171881 [details] [review] Make row optional in Gtk.TreeStore/ListStore.append override
Comment on attachment 171881 [details] [review] Make row optional in Gtk.TreeStore/ListStore.append override We might also want to add a the ability to do this: model.append(None,{COLUMN_ICON: icon, COLUMN_NAME: name}) Not important if you don't but can you add a TODO: Accept a dictionary for row where the keys represent the column number and the values represent what to set the column to
*** Bug 631764 has been marked as a duplicate of this bug. ***
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.