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

dbus module refactor + Volume implementation #42

Merged
merged 7 commits into from
Jan 5, 2024
Merged

dbus module refactor + Volume implementation #42

merged 7 commits into from
Jan 5, 2024

Conversation

Sinono3
Copy link
Owner

@Sinono3 Sinono3 commented Jan 2, 2024

It was probably better to split these changes into different PRs but well, here we are.

This PR includes:

  • Refactor of the dbus module:
    • Moved the module into its own directory.
    • Created a new module to store functions that register the MPRIS interfaces.
    • Fix a few clippy lints.
    • Better error handling (fixes Better error handling #32 for the D-Bus part)
  • Implementation of volume events for both dbus and zbus modules. Fixes Linux: Volume control #36

This release should not break previous usages of MediaControls with the dbus backend. The plan is to merge this PR and release 0.7.0, so the apps can implement the volume controls without waiting for the major refactor which is coming.

After this PR, I'm planning to migrate to zbus completely, since the library we use for dbus can be a bit annoying to work with at times because of the usage of the underlying C library, which has various side effects, e.g. places weird constraints on lifetimes, has a black-box error dbus::Error which is just a string, has non-static interface generation. This are most probably the hard limitations of the library being a C wrapper.

- Created a new module to store functions that register the MPRIS interfaces
- Removed a few unwraps
- Fixed a few clippy lints
- Check if the D-Bus connection has been succesfully created before
  launching the thread. This way we can handle the error before
  anything occurs.
- Check if the thread isn't running or has panicked at every method
  call of `MediaControls`.
@Sinono3
Copy link
Owner Author

Sinono3 commented Jan 2, 2024

I'll do some extra checks tomorrow and finally merge and release this.

@Sinono3 Sinono3 merged commit 2b1e31a into master Jan 5, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error handling dbus failure should concur to not attempt Linux: Volume control
1 participant