Open diogopessoa opened 2 years ago
Firstly, you need to base your new branch on the main
branch of Music which the current focus of development (I am assuming you know the essentials of development with git, Gtk4 and the Vala language). I am not that familiar with Music code but I would imagine a possible solution would be to place a button either in the headerbar at the top of the playlist or in an actionbar at the bottom which when pressed launches a Gtk.FileChooser (to be replaced by Gtk.FileDialog when available) suitably configured to allow selection of multiple music files (or a folder). The response can then be used to form an array of GLib.Files (FIle[]
) which can be passed to the playback manager in the same way as the open
function in Application.vala
does. You could look at the action_open
and action_open_folder
methods in Code for an idea how to use FileChooserNative (although that is in Gtk3 so may need some modification).
Probably best to get approval from the UX team for this feature (perhaps mockup something) before getting too deep into the coding.
Not sure how you would do this without some kind of activatable widget to click on and a filechooser dialog - there are multiple possibilities for visual details. You could also implement a keyboard accelerator but would need to make it discoverable.
But I thought this issue was about not using Files?. Being able to open folders in Music from Files is a different issue see #709.
Should be able to fix #709 by amending the .desktop
file to indicate that the app is capable of handling a folder uri as an opening argument. Files should then show Music in the "Open in" submenu when secondary-clicking on a folder. Then fix the playback manager so that it can handle being fed a folder - converting its contents to an array of music files.
Okay, will work on it ASAP
@aitor-gomila Thanks for making the effort to fix the issue you raised! If you need any help or a review let me know.
@jeremypw Thanks you too! Where is the .desktop file in the project source?
@aitor-gomila The desktop file is created from a template found at /data/music.desktop.in
.
It's being very hard for me to find docs. I can't go to definition
on GNOME Builder. How do you stat
on a File
(GFile) to see if it's a file or a folder?
@aitor-gomila You can use https://valadoc.org/glib-2.0/GLib.FileUtils.test.html
FileUtils.test (path, FileTest.IS_DIR)
Pushed a commit that should allow to open folders directly. The code is messy, can someone give me feedback on how to improve it? #747
Problem
Music doesn't have an option to open song or folder directly from the app.
Proposal
Have option to open File or Folder directly from Music.
Prior Art (Optional)
No response