Bottles icon indicating copy to clipboard operation
Bottles copied to clipboard

Use `add_pattern` over `add_mime_type` for FileFilters

Open TomChapple opened this issue 1 year ago • 4 comments

Description

Since 51.0, functionality with importing Bottle configurations via a YAML file have shown strange symptoms on a subset of Linux distributions. Until 51.5, this was limited to being unable to choose "All Files" as an option, but versions 51.6-51.10 now result in no filter being available, resulting in a complete inability to choose a YAML file. Attempts to circumvent this result in errors. Upon further investigation, it was found such symptoms existed on all file chooser dialogs.

After investigation, it was found that these versions differed in how the file patterns were defined. In 51.0+, the add_mime_type function is used whereas version 50.2 uses add_pattern for the YAML file filter. Reverting these filters to using add_pattern results in the filters now appearing as intended and being fully functional.

This comes with an unfortunate caveat in avoiding (what I believe to be) best practice in using the equivalent media types and their internationalised descriptions. However, I believe that this is necessary in order to preserve the intended functionality.

It is unknown why this problem happens in the first place as local proof of concepts using this same protocol do not experience the same issue. My hope is that this pull request would eventually be made redundant when the true cause for this issue is discovered and addressed.

Fixes #3154

Type of change

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

  • [x] Start Bottles and create a new bottle. Choose a custom configuration and proceed to the file dialog for choosing a YAML file. Observe that the list of filters include "YAML" and "All Files".
  • [x] Verify this on SteamOS that experienced this issue previously.
  • [ ] Verify this on a Linux distribution that did not experience this issue previously.

TomChapple avatar Dec 28 '23 02:12 TomChapple

As mentioned in the description, it would be best to verify that this bugfix I have submitted works both on the SteamOS version that was originally reported and on distributions that were not experiencing the issue originally. Testing this would require a local development environment, however, requiring that the branch in question is cloned and the following commands run (addressing any missing dependencies as they are found):

flatpak run org.flatpak.Builder --install --user --force-clean ./.flatpak-builder/out com.usebottles.bottles.yml
flatpak run --devel --allow=devel com.usebottles.bottles//master

As I do not have a Steam Deck or another device running SteamOS, any help would be greatly appreciated in verifying this fixes functionality.

TomChapple avatar Dec 28 '23 02:12 TomChapple

Thanks for this! I've tested your change on Steam Deck and can confirm it works great. I am now able to see the yaml in the file picker, and selecting it correctly loads the config.

I am unable to Verify this on a Linux distribution that did not experience this issue previously as every distro I use is experiencing this issue (which this PR seems to fix on all I've tested).

eskay993 avatar Jan 21 '24 16:01 eskay993

Hi! Given that this has been verified both on a Steam Deck and a non-Steam Deck that experienced this issue, could this be verified by a maintainer to ensure it continues to work as intended for those not experiencing the issue?

TomChapple avatar Feb 17 '24 07:02 TomChapple