diff --git a/data/music.metainfo.xml.in b/data/music.metainfo.xml.in index c2b7262f5..9e8108e8d 100644 --- a/data/music.metainfo.xml.in +++ b/data/music.metainfo.xml.in @@ -51,6 +51,15 @@ contact_at_elementary.io + + + Improvements: + + Drag and drop whole folders into the queue + + + + Improvements: @@ -89,13 +98,6 @@ - - - Fix removing items from the queue - Fix equalizer sliders not properly disabled sometimes - Updated translations - Performance improvements - - + diff --git a/src/MainWindow.vala b/src/MainWindow.vala index 4d1be9fbb..1d788ebb1 100644 --- a/src/MainWindow.vala +++ b/src/MainWindow.vala @@ -115,9 +115,19 @@ public class Music.MainWindow : Gtk.ApplicationWindow { drop_target.on_drop.connect ((target, value, x, y) => { if (value.type () == typeof (Gdk.FileList)) { - File[] files; + SList file_list = null; foreach (unowned var file in (SList) value.get_boxed ()) { + var file_type = file.query_file_type (FileQueryInfoFlags.NONE); + if (file_type == FileType.DIRECTORY) { + prepend_directory_files (file, ref file_list); + } else { + file_list.prepend (file); + } + } + + file_list.reverse (); + foreach (unowned var file in file_list) { files += file; } @@ -151,6 +161,29 @@ public class Music.MainWindow : Gtk.ApplicationWindow { }); } + //Array concatenation not permitted for parameters so use a list instead + private void prepend_directory_files (GLib.File dir, ref SList file_list) { + try { + var enumerator = dir.enumerate_children ( + "standard::*", + FileQueryInfoFlags.NOFOLLOW_SYMLINKS, + null + ); + + FileInfo info = null; + while ((info = enumerator.next_file (null)) != null) { + var child = dir.resolve_relative_path (info.get_name ()); + if (info.get_file_type () == FileType.DIRECTORY) { + prepend_directory_files (child, ref file_list); + } else { + file_list.prepend (child); + } + } + } catch (Error e) { + warning ("Error while enumerating children of %s: %s", dir.get_uri (), e.message); + } + } + private void update_repeat_button () { switch (settings.get_string ("repeat-mode")) { case "disabled":
Improvements:
Fix removing items from the queue
Fix equalizer sliders not properly disabled sometimes
Updated translations
Performance improvements