mpris_server/
property.rs

1use crate::{
2    LoopStatus, Metadata, PlaybackRate, PlaybackStatus, Playlist, PlaylistOrdering, Volume,
3};
4
5/// Used for emitting `PropertiesChanged` signals on
6/// [`Server::properties_changed`] and [`LocalServer::properties_changed`].
7///
8/// [`Server::properties_changed`]: crate::Server::properties_changed
9/// [`LocalServer::properties_changed`]: crate::LocalServer::properties_changed
10#[derive(Clone, Debug, PartialEq)]
11pub enum Property {
12    CanQuit(bool),
13    Fullscreen(bool),
14    CanSetFullscreen(bool),
15    CanRaise(bool),
16    HasTrackList(bool),
17    Identity(String),
18    DesktopEntry(String),
19    SupportedUriSchemes(Vec<String>),
20    SupportedMimeTypes(Vec<String>),
21    PlaybackStatus(PlaybackStatus),
22    LoopStatus(LoopStatus),
23    Rate(PlaybackRate),
24    Shuffle(bool),
25    Metadata(Metadata),
26    Volume(Volume),
27    // Position (must use `Rate` property together with `Seeked` signal instead)
28    MinimumRate(PlaybackRate),
29    MaximumRate(PlaybackRate),
30    CanGoNext(bool),
31    CanGoPrevious(bool),
32    CanPlay(bool),
33    CanPause(bool),
34    CanSeek(bool),
35    // CanControl (not expected to change)
36}
37
38/// Used for emitting `PropertiesChanged` signals on
39/// [`Server::track_list_properties_changed`] and
40/// [`LocalServer::track_list_properties_changed`], if `T` implements
41/// [`TrackListInterface`] or [`LocalTrackListInterface`].
42///
43/// [`Server::track_list_properties_changed`]: crate::Server::track_list_properties_changed
44/// [`LocalServer::track_list_properties_changed`]: crate::LocalServer::track_list_properties_changed
45/// [`TrackListInterface`]: crate::TrackListInterface
46/// [`LocalTrackListInterface`]: crate::LocalTrackListInterface
47#[derive(Clone, Debug, PartialEq, Eq)]
48pub enum TrackListProperty {
49    // The new value must not be sent according to the spec.
50    Tracks,
51    CanEditTracks(bool),
52}
53
54/// Used for emitting `PropertiesChanged` signals on
55/// [`Server::playlists_properties_changed`] and
56/// [`LocalServer::playlists_properties_changed`], if `T` implements
57/// [`PlaylistsInterface`] or [`LocalPlaylistsInterface`].
58///
59/// [`Server::playlists_properties_changed`]: crate::Server::playlists_properties_changed
60/// [`LocalServer::playlists_properties_changed`]: crate::LocalServer::playlists_properties_changed
61/// [`PlaylistsInterface`]: crate::PlaylistsInterface
62/// [`LocalPlaylistsInterface`]: crate::LocalPlaylistsInterface
63#[derive(Clone, Debug, PartialEq, Eq)]
64pub enum PlaylistsProperty {
65    PlaylistCount(u32),
66    Orderings(Vec<PlaylistOrdering>),
67    ActivePlaylist(Option<Playlist>),
68}