GNOME Bugzilla – Bug 147337
dragging songs to source list should create new playlist
Last modified: 2005-08-25 02:45:34 UTC
This is a feature from iTunes: You can select multiple songs and simply drag them to an empty spot in the source list to create a new playlist containing those songs.
Created attachment 50781 [details] [review] patch This was very nearly already working in 0.9. The attached patch fixes this and a few related sourcelist DnD issues. For DnD into the sourcelist: - accept text/uri-list with no destination path (this bug) - check for the text/x-rhythmbox-* types before text/uri-list - prefer same over text/uri-list (ordering in target_table in rb-shell.c) also: - only specify a playlist name for autoplaylists; specifying NULL attempts to edit the new playlist name, which seems right to me. - kill some unused stuff in rb-sourcelist-model.c This also re-enables creation of one genre/artist/album autoplaylists by dragging from the property view into the sourcelist, which is kind of nice.
Created attachment 51081 [details] [review] better patch Now does multiple genre/artist/album autoplaylists by dragging from property views, and leaks less memory. I moved the property view dnd code into the property model, so it could make use of rb-tree-dnd to do multi-select drag and drop properly. Without this, dragging multiple selected property values was tricky. It'd only work if you started dragging with the same click that selected the last property value. I had to add a new optional method to the rb-tree-dnd drop target interface to allow the target to select the dnd type. Otherwise, dragging from a property view to a static playlist would fail, as the autoplaylist dnd type would be selected, so we'd end up creating a new playlist. If I switched the target list around so text/uri-list was preferred, autoplaylist dnd would never happen.
I can't comment on the code, because I don't know enough about the techinical side of DnD, but the patch works well for me. Unless there are issues you know about that need fixing, this looks fine to commit. One nice thing this patch also lets you do, is drag an item from a property view to another application and have it work correctly - by passing the URIs. This is really handy because it lets you add all the songs by an artist to the totem playlist, or copy them to a folder (by dragging them to Nautilus).
As it is, this patch breaks reordering of playlists by dragging in the source list. I've almost got that working properly again (better than it was before). I'll attach an updated patch when I'm done.
Created attachment 51191 [details] [review] more patch Fixes playlist reorder DnD, reworks the playlist manager so it uses the sourcelist rather than its own list (so reordering is persistent), and implements text/uri-list drag target for playlists in the sourcelist, so you can drag playlists to other apps (fixes bug 307310).
The playlist re-ordering doesn't work for me. If I have any automatic playlists, I can't drag any playlist to a position directly below an automatic one. When I can drag a playlist, it doesn't move to the correct position.
Created attachment 51222 [details] [review] will I ever get this right? All playlists are now reorderable. If other source types should be reorderable, we should probably add a rb_source_is_reorderable (or something) to figure it out.
Created attachment 51244 [details] [review] apparently not Source reordering now works if there are invisible sources too.
That last patch works perfectly for me - and looks fine to be committed.
Created attachment 51297 [details] [review] just one more.. Updated to apply cleanly to current (anon) CVS, and to remove a couple of unused variables that would have caused build breaks. Please commit.
2005-08-25 James Livingston <jrl@ids.org.au> Patch from Jonathan Mattnew <jonathan@kaolin.hn.org> * lib/rb-tree-dnd.c: (rb_tree_dnd_drag_drop_cb): * lib/rb-tree-dnd.h: * rhythmdb/rhythmdb-property-model.c: (rhythmdb_property_model_class_init), (rhythmdb_property_model_drag_source_init), (rhythmdb_property_model_iter_parent), (rhythmdb_property_model_row_draggable), (rhythmdb_property_model_drag_data_delete), (query_model_cb), (rhythmdb_property_model_drag_data_get), (rhythmdb_property_model_enable_drag): * rhythmdb/rhythmdb-property-model.h: * shell/rb-playlist-manager.c: (rb_playlist_manager_finalize), (rb_playlist_manager_set_property), (append_new_playlist_source), (rb_playlist_manager_save_playlists): * shell/rb-shell.c: (rb_shell_construct), (sourcelist_drag_received_cb): * sources/rb-iradio-source.c: (rb_iradio_source_class_init): * sources/rb-playlist-source.c: (impl_receive_drag): * sources/rb-sourcelist-model.c: (rb_sourcelist_model_class_init), (rb_sourcelist_model_drag_dest_init), (rb_sourcelist_model_set_dnd_targets), (rb_sourcelist_model_drag_data_received), (path_is_reorderable), (rb_sourcelist_model_row_drop_position), (rb_sourcelist_model_get_drag_target), (rb_sourcelist_model_drag_data_get): * sources/rb-sourcelist-model.h: * sources/rb-sourcelist.c: (rb_sourcelist_class_init), (rb_sourcelist_init), (rb_sourcelist_get_property), (rb_sourcelist_selection_changed_cb): * sources/rb-sourcelist.h: * widgets/rb-property-view.c: (rb_property_view_constructor): Greatly improve drag-n-drop support. Allow dragging of item from property views to the source list, to create new automatic playlists. Allow playlist re-ordering. Fix dragging from Rhythmbox to other applications. (Closes bug 147337)