diff options
author | Vivia Nikolaidou <vivia@ahiru.eu> | 2022-08-18 15:04:15 +0300 |
---|---|---|
committer | Vivia Nikolaidou <vivia@ahiru.eu> | 2022-08-22 17:58:43 +0300 |
commit | 560611134588f63270a569e92160ecac5ceabc37 (patch) | |
tree | ac5f4447c55c1e5dd4d8f15f92c335c36aa5bab8 /audio/spotify | |
parent | 84f6484140098826b3f074d806e0eb052198df43 (diff) |
plugins: Simplify code using ParamSpecBuilder
Diffstat (limited to 'audio/spotify')
-rw-r--r-- | audio/spotify/src/spotifyaudiosrc/imp.rs | 78 |
1 files changed, 36 insertions, 42 deletions
diff --git a/audio/spotify/src/spotifyaudiosrc/imp.rs b/audio/spotify/src/spotifyaudiosrc/imp.rs index 402af8ad2..93d1ba94a 100644 --- a/audio/spotify/src/spotifyaudiosrc/imp.rs +++ b/audio/spotify/src/spotifyaudiosrc/imp.rs @@ -88,48 +88,42 @@ impl ObjectSubclass for SpotifyAudioSrc { impl ObjectImpl for SpotifyAudioSrc { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| { - vec![glib::ParamSpecString::new( - "username", - "Username", - "Spotify device username from https://www.spotify.com/us/account/set-device-password/", - Some(""), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), - glib::ParamSpecString::new( - "password", - "Password", - "Spotify device password from https://www.spotify.com/us/account/set-device-password/", - Some(""), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), - glib::ParamSpecString::new( - "cache-credentials", - "Credentials cache", - "Directory where to cache Spotify credentials", - Some(""), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), - glib::ParamSpecString::new( - "cache-files", - "Files cache", - "Directory where to cache downloaded files from Spotify", - Some(""), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), - glib::ParamSpecUInt64::new( - "cache-max-size", - "Cache max size", - "The max allowed size of the cache, in bytes, or 0 to disable the cache limit", - 0, u64::MAX, 0, - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), - glib::ParamSpecString::new( - "track", - "Spotify URI", - "Spotify track URI, in the form 'spotify:track:$SPOTIFY_ID'", - Some(""), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_READY, - ), + vec![glib::ParamSpecString::builder("username") + .nick("Username") + .blurb("Spotify device username from https://www.spotify.com/us/account/set-device-password/") + .default_value(Some("")) + .mutable_ready() + .build(), + glib::ParamSpecString::builder("password") + .nick("Password") + .blurb("Spotify device password from https://www.spotify.com/us/account/set-device-password/") + .default_value(Some("")) + .mutable_ready() + .build(), + glib::ParamSpecString::builder("cache-credentials") + .nick("Credentials cache") + .blurb("Directory where to cache Spotify credentials") + .default_value(Some("")) + .mutable_ready() + .build(), + glib::ParamSpecString::builder("cache-files") + .nick("Files cache") + .blurb("Directory where to cache downloaded files from Spotify") + .default_value(Some("")) + .mutable_ready() + .build(), + glib::ParamSpecUInt64::builder("cache-max-size") + .nick("Cache max size") + .blurb("The max allowed size of the cache, in bytes, or 0 to disable the cache limit") + .default_value(0) + .mutable_ready() + .build(), + glib::ParamSpecString::builder("track") + .nick("Spotify URI") + .blurb("Spotify track URI, in the form 'spotify:track:$SPOTIFY_ID'") + .default_value(Some("")) + .mutable_ready() + .build(), ] }); |