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 506853 - gtk_tree_view_enable_model_drag_[source|dest] problem
gtk_tree_view_enable_model_drag_[source|dest] problem
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
2.12.x
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
Depends on:
Blocks: 516092
 
 
Reported: 2008-01-02 13:50 UTC by Christian Persch
Modified: 2008-06-10 12:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proposed patch (7.53 KB, patch)
2008-01-02 13:53 UTC, Christian Persch
accepted-commit_now Details | Review

Description Christian Persch 2008-01-02 13:50:28 UTC
gtk_tree_view_enable_model_drag_[source|dest] calls gtk_drag_[source|dest]_set with the passed-in targets list, but it also stores the targets list internally. That makes it impossible to add targets later on, e.g. with gtk_drag_*_add_text_targets and gtk_drag_*_add_uri_targets.
Comment 1 Christian Persch 2008-01-02 13:53:08 UTC
Created attachment 101989 [details] [review]
proposed patch

No need to store the source/dest targets lists; gtk_drag_*_get_target_list provides it.

While I was there, I converted the file to use GSlice for small allocations.
Comment 2 Matthias Clasen 2008-01-05 05:13:39 UTC
Looks fine to me, assuming you have given it some testing.
Comment 3 Kristian Rietveld 2008-01-10 10:22:36 UTC
*shrug*, I haven't written the DnD code for GtkTreeView and it is quite a big mess in my opinion (will be rewriting all DnD code at some point in my experimental tree view thing).  I cannot really say whether storing the target list internally was done deliberately to make some things impossible or not ...  To me it feels like that the complete thing will blow up if the user clears or sets another target list without the GTK_TREE_MODEL_ROW entry if the patch is applied.  Without the patch applied this will not happen ...

Comment 4 Christian Persch 2008-01-10 12:16:46 UTC
Kris: calling gtk_tree_view_enable_model_drag_dest/source unsets the reorderable property, and if you turn it on afterwards, it calls gtk_tree_view_enable_model_drag_dest and _source with the "GTK_TREE_MODEL_ROW" target. So this isn't a problem with the patch.
I can certainly add documentation to gtk_tree_view_enable_model_drag_dest/source that one should not call gtk_drag_dest/source_set  directly but only those methods.
Comment 5 Christian Persch 2008-06-08 11:42:46 UTC
Kris: ping?
Comment 6 Kristian Rietveld 2008-06-08 13:50:55 UTC
Sorry for the long delay.... I looked at it again now and it all makes sense and looks fine to me.  Could you please commit the GSlice refactorings separately from the target list business?  Thanks!

Comment 7 Christian Persch 2008-06-10 12:34:07 UTC
Committed in 2 runs:

	* gtk/gtktreeview.c: (gtk_tree_view_button_release_drag_column),
	(dest_row_free), (set_dest_row), (ensure_info),
	(gtk_tree_view_remove), (gtk_tree_view_put),
	(gtk_tree_view_set_column_drag_info): Use GSlice. Patch from
	bug #506853.

	* gtk/gtktreeview.c: (destroy_info), (set_destination_row),
	(gtk_tree_view_maybe_begin_dragging_row),
	(gtk_tree_view_set_reorderable),
	(gtk_tree_view_enable_model_drag_source),
	(gtk_tree_view_enable_model_drag_dest),
	(gtk_tree_view_unset_rows_drag_source),
	(gtk_tree_view_unset_rows_drag_dest): Make
	gtk_tree_view_enable_model_drag_[source|dest] compatible with
	gtk_drag_[source|dest]_add_*_targets. Bug #506853.