GNOME Bugzilla – Bug 649979
Argument count TypeError from Gtk.TreeView.enable_model_drag_source()
Last modified: 2011-09-01 16:49:37 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.
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?
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?
Reassigning to gtk+ so a maintainer can review it.
Review of attachment 187653 [details] [review]: Looks good, thanks. For future patches, please use "git format-patch" style patches.
Reopening. Can I backport fixes like this to gtk-3-0 branch?
Seems like an obvious yes? Needed for introspection users such as alacarte in bug 626220.
sure, go for it
Pushed to gtk-3-0 and gtk-2-24 as well.