GNOME Bugzilla – Bug 679415
Add an override for Gtk.TreeView.insert_column_with_attributes() (varargs)
Last modified: 2012-09-03 11:08:43 UTC
Created attachment 218034 [details] Example showing "insert_column_with_attributes" doesn't exist Hello, I'm porting Sugar InfoSlicer Activity from gtk2 to Gtk3 [1] and I found that "Gtk.TreeView.insert_column_with_attributes" doesn't exist (Gtk3) but the documentation says it should be there[2] I'm attaching an example that shows the problem here. See you and thanks, [1] http://bugs.sugarlabs.org/ticket/3742 [2] http://developer.gnome.org/gtk3/3.5/GtkTreeView.html#gtk-tree-view-insert-column-with-attributes
This method uses varargs, which are not introspectable. You have to use the non-varargs API such as gtk_tree_view_column_add_attribute() and gtk_tree_view_insert_column(), I'm afraid.
Actually, we can write an override for this to mimic the behaviour, similar to bug 680320.
This seems to work fine for me, I just added a test case: http://git.gnome.org/browse/pygobject/commit/?id=94e5d58e7794de91d3291e0e51c42070da4fc92b Can you please attach a complete code example which breaks? Which version of pygobject are you using?
Sorry, ignore the previous comment. That was meant to go to another bug.
Created attachment 219902 [details] [review] patch Fixed by Martin Pitt and John Palmieri, test case by Paolo Borelli and Marta Maria Casetti
Thank you for working on this! This nicely makes another missing API available indeed. The actual override looks good to me, but the test case still needs some work. It does not actually supply any attributes to any of the three created columns, it does not test the properties of two of the three created columns, and it fails for me in jhbuild: ====================================================================== ERROR: test_tree_view_add_column_with_attributes (test_overrides.TestGtk) ---------------------------------------------------------------------- Traceback (most recent call last):
+ Trace 230609
self.assertEqual(tree.get_column(1).get_title(), 'Test1')
I'm afraid I won't have time today any more to fix this, and I'll be on holidays until August 20 after GUADEC. I can try to fix it after this, but of course you (or anyone else) is very welcome to improve it yourself. Thanks!
I completed the test case, which also uncovered a bug in the override: You need to call set_attributes() after adding the column apparently, otherwise you'll get (runtests.py:23536): Gtk-CRITICAL **: gtk_cell_area_attribute_connect: assertion `gtk_cell_area_has_renderer (area, renderer)' failed Pushed now: http://git.gnome.org/browse/pygobject/commit/?id=542cf22c9de9b2094868c4e879b0f24b15c4c012 Thanks!