Skip to content

[v3] Make filtered dialog examples code work for linux #4287

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

Conversation

bh90210
Copy link
Contributor

@bh90210 bh90210 commented May 17, 2025

Description

Filters for file dialogs do not work as intended.

dialog := application.OpenFileDialog().
			SetTitle("Select a file").
...
			AddFilter("Text Files", "*.txt; *.md").
			AddFilter("Video Files", "*.mov; *.mp4; *.avi")

the above snippet is from v3/examples/dialogs/main.go:l275
Right now it would produce an empty selection list for both filters.

I looked on github for C implementations of gtk_file_filter_add_pattern https://github.com/search?q=gtk_file_filter_add_pattern&type=code and indeed people seem to support the ; separator for patterns but it seems this is not something gtk does for you.

Type of change

Please select the option that is relevant.

  • 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?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration using wails doctor.

  • Windows
  • macOS
  • Linux

If you checked Linux, please specify the distro and version.

Test Configuration

wails doctor

      Wails Doctor          

▄ Scanning system - Please wait (this may take a long time)... (1s)^C⏎
byron@byron-X570-UD /m/w/wailsfork (bugfix/v3-alpha_linux-dialog-filter-pattern) [SIGINT]> wails3 doctor
Wails (v3.0.0-dev) Wails Doctor

System

WARNING: failed to read int from file: open /sys/devices/system/cpu/cpu0/online: no such file or directory
┌────────────────────────────────────────────────────────────────────────────────┐
| Name | Ubuntu |
| Version | 24.04 |
| ID | ubuntu |
| Branding | 24.04.2 LTS (Noble Numbat) |
| Platform | linux |
| Architecture | amd64 |
| CPU | AMD Ryzen 9 3900X 12-Core Processor |
| GPU 1 | Unknown |
| GPU 2 | TU116 [GeForce GTX 1660] (NVIDIA Corporation) - Driver: nvidia |
| Memory | 32GB |
└────────────────────────────────────────────────────────────────────────────────┘

Build Environment

┌─────────────────────────────────────────────────────────┐
| Wails CLI | v3.0.0-dev |
| Go Version | go1.24.0 |
| Revision | 2abd05f |
| Modified | false |
| -buildmode | exe |
| -compiler | gc |
| CGO_CFLAGS | -I/usr/local/cuda-11.8/include/ |
| CGO_CPPFLAGS | |
| CGO_CXXFLAGS | |
| CGO_ENABLED | 1 |
| CGO_LDFLAGS | |
| GOAMD64 | v1 |
| GOARCH | amd64 |
| GOOS | linux |
| vcs | git |
| vcs.modified | false |
| vcs.revision | 2abd05f |
| vcs.time | 2025-04-28T12:27:50Z |
└─────────────────────────────────────────────────────────┘

Dependencies

┌──────────────────────────────────────┐
| gtk3 | 3.24.41-4ubuntu1.3 |
| npm | 10.8.3 |
| pkg-config | 1.8.1-2build1 |
| webkit2gtk | 2.48.1-0ubuntu0.24.04.1 |
| gcc | 12.10ubuntu1 |
| |
└────── * - Optional Dependency ───────┘

Checking for issues

SUCCESS No issues found

Diagnosis

SUCCESS Your system is ready for Wails development!

Need documentation? Run: wails3 docs
♥ If Wails is useful to you or your company, please consider sponsoring the project: wails3 sponsor

Summary by CodeRabbit

  • Bug Fixes
    • Improved file filter handling in file chooser dialogs to correctly support multiple patterns separated by semicolons, ensuring all specified file types are properly recognized and selectable.
    • Fixed a Linux-specific issue that prevented filtered dialogs from working correctly.

Copy link
Contributor

coderabbitai bot commented May 17, 2025

Walkthrough

The update revises the internal logic of the runChooserDialog function to correctly handle multiple file filter patterns separated by semicolons. Each pattern is now individually processed and registered with the GTK file filter, instead of treating the entire pattern string as a single entry. Additionally, the changelog was updated to document the fix of a Linux bug related to filtered dialogs.

Changes

File(s) Change Summary
v3/pkg/application/linux_cgo.go Updated runChooserDialog to split filter patterns by semicolons, trim whitespace, and add each pattern individually to GTK file filter. No changes to exported/public entities.
docs/src/content/docs/changelog.mdx Added a new "Fixed" entry documenting the Linux filtered dialog bug fix with contributor and PR reference. No structural changes.

Possibly related PRs

Suggested reviewers

  • leaanthony

Poem

A bunny with code on its mind,
Found filters all tangled, combined.
With a snip and a split,
Each pattern now fits—
Hopping through dialogs, refined!
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eda18d0 and 15bd7c5.

📒 Files selected for processing (2)
  • docs/src/content/docs/changelog.mdx (1 hunks)
  • v3/pkg/application/linux_cgo.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/src/content/docs/changelog.mdx
  • v3/pkg/application/linux_cgo.go
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Run Go Tests v3 (macos-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (ubuntu-latest, 1.24)
  • GitHub Check: Run Go Tests v3 (windows-latest, 1.24)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@bh90210 bh90210 changed the title Make examples code work Make dialog examples code work for linux May 17, 2025
@bh90210 bh90210 changed the title Make dialog examples code work for linux [v3] Make dialog examples code work for linux May 17, 2025
@bh90210 bh90210 changed the title [v3] Make dialog examples code work for linux [v3] Make filtered dialog examples code work for linux May 17, 2025
@leaanthony
Copy link
Member

@bh90210 - Great to see you again!
Thanks for this 🙏 Please could you add an entry to the changelog located at docs/src/content/docs/changelog.mdx? Thanks!

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 16, 2025
@github-actions github-actions bot added the Documentation Improvements or additions to documentation label Jun 16, 2025
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 18, 2025
@leaanthony leaanthony merged commit 7b7f3cd into wailsapp:v3-alpha Jun 18, 2025
52 of 53 checks passed
@leaanthony
Copy link
Member

Amazing! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Improvements or additions to documentation lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files. v3-alpha
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants