Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open song or folder from Music #716

Open
diogopessoa opened this issue Jun 17, 2022 · 12 comments
Open

Open song or folder from Music #716

diogopessoa opened this issue Jun 17, 2022 · 12 comments

Comments

@diogopessoa
Copy link

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

@jeremypw
Copy link
Collaborator

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.

@jeremypw
Copy link
Collaborator

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.

@jeremypw
Copy link
Collaborator

jeremypw commented Mar 27, 2023

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.

@jeremypw
Copy link
Collaborator

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.

@ghost
Copy link

ghost commented Mar 27, 2023

Okay, will work on it ASAP

@jeremypw
Copy link
Collaborator

@aitor-gomila Thanks for making the effort to fix the issue you raised! If you need any help or a review let me know.

@ghost
Copy link

ghost commented Mar 29, 2023

@jeremypw Thanks you too! Where is the .desktop file in the project source?

@jeremypw
Copy link
Collaborator

@aitor-gomila The desktop file is created from a template found at /data/music.desktop.in.

@ghost
Copy link

ghost commented Apr 1, 2023

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?

@lenemter
Copy link
Member

lenemter commented Apr 1, 2023

@aitor-gomila You can use https://valadoc.org/glib-2.0/GLib.FileUtils.test.html
FileUtils.test (path, FileTest.IS_DIR)

@ghost ghost mentioned this issue Apr 1, 2023
3 tasks
@ghost
Copy link

ghost commented Apr 2, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants
@jeremypw @diogopessoa @lenemter and others