Dvlv / BoxBuddyRS

A Graphical Interface for Distrobox
MIT License
229 stars 24 forks source link

Add feature Volumes #44

Closed VortexAcherontic closed 7 months ago

VortexAcherontic commented 7 months ago

There we are, finally 😄 I added the feature #25 to add additional volumes to a distrobox container.

It works as follows: If the application has host access it will show a new section starting with a PreferencesGroup in the new container popup.
There is also an invisible BoxList below the Volumes PreferencesGroup which will hold the addional volumes if any are added.

Bildschirmfoto vom 2024-02-04 14-31-23

Upon clicking on the plus button on the right a FileDialog will open to let the user chose a new directory.
If the directory is inside the users /home/username it will show a warning as Distrobox will already have access to it.
For this I added a new utility function to read the users $HOME environment variable.

Bildschirmfoto vom 2024-02-04 14-31-31

In all other cases a new entry will be added to the list below and the list will be made visible.

Bildschirmfoto vom 2024-02-04 14-50-59

Each entry consist of 3 elements. The title indicating the path of the host system.
An EntryRow indicating the path inside the container which is also editable by the user.
And of course a button to remove the volume.

What is currently not implemented is an additional check if a new volume path is already a child of an already added volume path.

After hitting create the Volumes ListBox will be iterated and the title as well as the text of each entry row will be read and pushed into one single string of the form /host/path:/container/path which is then stored inside a Vec<String>.

The Vectors containing all volume directives is passed to the create_box helper function.
If the vectors passed to create_box is not empty it will iterate all elements and push --volume /host/path:/container/path to the create args each.

If the vectors was empty the create_box method will ignore it.

Bildschirmfoto vom 2024-02-04 14-34-10

While there are still some minor improvements/cosmetics I aim for I'd still like to contribute the current "v1" of the feature hereby.

Kind regards,
V.

Dvlv commented 7 months ago

Nice one, thank you. I'll merge this in now, tidy up a bit, then release this, distrobox-assemble support and the new logo as version 2.0.0 (probably some time this weekend)