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 649979 - Argument count TypeError from Gtk.TreeView.enable_model_drag_source()
Argument count TypeError from Gtk.TreeView.enable_model_drag_source()
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.0.x
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 626220
 
 
Reported: 2011-05-11 16:56 UTC by Micah Carrick
Modified: 2011-09-01 16:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This example demonstrates the bug. (1.47 KB, text/x-python)
2011-05-11 16:56 UTC, Micah Carrick
  Details
Patch gtk/gtktreeview.c to add the annotation (617 bytes, patch)
2011-05-11 18:55 UTC, Micah Carrick
accepted-commit_now Details | Review

Description Micah Carrick 2011-05-11 16:56:32 UTC
Created attachment 187644 [details]
This example demonstrates the bug.

When trying to call Gtk.TreeView.enable_model_drag_source() a TypeError is raised:

enable_model_drag_source() takes exactly 5 argument(s) (4 given)

It seems like it wants the n_targets argument, which it shouldn't in Python. If you *do* give it the n_targets you get a similar error:

enable_model_drag_source() takes exactly 4 arguments (5 given)

I can get it to work if I hack /gi/overrides/Gtk.py on line 1089, adding the len(targets) to the call to super(TreeView, self).enable_model_drag_source(). It seems as if Gtk.TreeView wants 4 arguments but it's parent class wants 5. I know my hack isn't the way this is all supposed to work so I'll leave it to you folks.

I have pygobject 2.28.4 on Fedora 15.

I attached a simple demo of the bug in action. Don't know if the same is found in enable_model_drag_dest() as I haven't gotten that far.
Comment 1 Micah Carrick 2011-05-11 18:25:10 UTC
Looking into this a little more, I think this is actually a bug in the gtk-doc in GTK+ 3.x.

It looks like the gtk-doc for gtk_tree_view_enable_model_drag_source() is missing the annotation "(array length=n_targets)". Seems like an easy fix. Can this bug report be moved to gtk3 or should I submit a new bug report there?
Comment 2 Micah Carrick 2011-05-11 18:55:43 UTC
Created attachment 187653 [details] [review]
Patch gtk/gtktreeview.c to add the annotation

Looks like the gtk-doc for gtk_tree_view_enable_model_drag_source() is missing the "(array length=n_targets)" annotation. I also sent this patch to gtk-devel-list since perhaps it's not a pygobject issue?
Comment 3 José Aliste 2011-05-11 19:23:05 UTC
Reassigning to gtk+ so a maintainer can review it.
Comment 4 Colin Walters 2011-05-11 20:36:22 UTC
Review of attachment 187653 [details] [review]:

Looks good, thanks.

For future patches, please use "git format-patch" style patches.
Comment 5 johnp 2011-06-21 16:20:24 UTC
Reopening.  Can I backport fixes like this to gtk-3-0 branch?
Comment 6 Olav Vitters 2011-08-22 07:36:49 UTC
Seems like an obvious yes? Needed for introspection users such as alacarte in bug 626220.
Comment 7 Matthias Clasen 2011-08-22 22:58:22 UTC
sure, go for it
Comment 8 Federico Mena Quintero 2011-09-01 16:49:37 UTC
Pushed to gtk-3-0 and gtk-2-24 as well.