Skip to content

Commit

Permalink
Merge pull request #3221 from TomChapple/mime-to-pattern-filters
Browse files Browse the repository at this point in the history
Use `add_pattern` over `add_mime_type` for FileFilters
  • Loading branch information
mirkobrombin authored Mar 25, 2024
2 parents cfd57fb + f72e79c commit 75b3873
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
14 changes: 11 additions & 3 deletions bottles/frontend/utils/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@
def add_executable_filters(dialog):
filter = Gtk.FileFilter()
filter.set_name(_("Supported Executables"))
filter.add_mime_type("application/x-ms-dos-executable")
filter.add_mime_type("application/x-msi")
# TODO: Investigate why `filter.add_mime_type(...)` does not show filter in all distributions.
# Intended MIME types are:
# - `application/x-ms-dos-executable`
# - `application/x-msi`
filter.add_pattern("*.exe")
filter.add_pattern("*.msi")

dialog.add_filter(filter)


def add_yaml_filters(dialog):
filter = Gtk.FileFilter()
filter.set_name("YAML")
filter.add_mime_type("application/x-yaml")
# TODO: Investigate why `filter.add_mime_type(...)` does not show filter in all distributions.
# Intended MIME types are:
# - `application/yaml`
filter.add_pattern("*.yml")
filter.add_pattern("*.yaml")

dialog.add_filter(filter)

Expand Down
5 changes: 4 additions & 1 deletion bottles/frontend/views/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ def set_path(_dialog, response):

filter = Gtk.FileFilter()
filter.set_name("GNU Gzip Archive")
filter.add_mime_type("application/gzip")
# TODO: Investigate why `filter.add_mime_type(...)` does not show filter in all distributions.
# Intended MIME types are:
# - `application/gzip`
filter.add_pattern("*.gz")

dialog.add_filter(filter)
add_all_filters(dialog)
Expand Down

0 comments on commit 75b3873

Please sign in to comment.