After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 679415 - Add an override for Gtk.TreeView.insert_column_with_attributes() (varargs)
Add an override for Gtk.TreeView.insert_column_with_attributes() (varargs)
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: introspection
3.0.x
Other Linux
: Normal normal
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2012-07-04 18:22 UTC by Manuel Kaufmann
Modified: 2012-09-03 11:08 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Example showing "insert_column_with_attributes" doesn't exist (289 bytes, text/x-python)
2012-07-04 18:22 UTC, Manuel Kaufmann
  Details
patch (1.92 KB, patch)
2012-07-30 15:18 UTC, Marta Maria Casetti
needs-work Details | Review

Description Manuel Kaufmann 2012-07-04 18:22:38 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
Comment 1 Martin Pitt 2012-07-24 13:10:09 UTC
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.
Comment 2 Martin Pitt 2012-07-24 13:24:31 UTC
Actually, we can write an override for this to mimic the behaviour, similar to bug 680320.
Comment 3 Martin Pitt 2012-07-30 10:03:45 UTC
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?
Comment 4 Martin Pitt 2012-07-30 10:04:26 UTC
Sorry, ignore the previous comment. That was meant to go to another bug.
Comment 5 Marta Maria Casetti 2012-07-30 15:18:37 UTC
Created attachment 219902 [details] [review]
patch

Fixed by Martin Pitt and John Palmieri, test case by Paolo Borelli and Marta Maria Casetti
Comment 6 Martin Pitt 2012-07-31 14:38:59 UTC
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):
  • File "/home/martin/upstream/pygobject/tests/test_overrides.py", line 1686 in test_tree_view_add_column_with_attributes
    self.assertEqual(tree.get_column(1).get_title(), 'Test1')
AttributeError: 'NoneType' object has no attribute 'get_title'

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!
Comment 7 Martin Pitt 2012-09-03 11:08:43 UTC
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!