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 /text/ahead | |
parent | 84f6484140098826b3f074d806e0eb052198df43 (diff) |
plugins: Simplify code using ParamSpecBuilder
Diffstat (limited to 'text/ahead')
-rw-r--r-- | text/ahead/src/textahead/imp.rs | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/text/ahead/src/textahead/imp.rs b/text/ahead/src/textahead/imp.rs index 1ecf4d3f..226f30c7 100644 --- a/text/ahead/src/textahead/imp.rs +++ b/text/ahead/src/textahead/imp.rs @@ -103,37 +103,31 @@ impl ObjectImpl for TextAhead { let default = Settings::default(); vec![ - glib::ParamSpecUInt::new( - "n-ahead", - "n-ahead", - "The number of ahead text buffers to display along with the current one", - 0, - u32::MAX, - default.n_ahead, - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING, - ), - glib::ParamSpecString::new( - "separator", - "Separator", - "Text inserted between each text buffers", - Some(&default.separator), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING, - ), + glib::ParamSpecUInt::builder("n-ahead") + .nick("n-ahead") + .blurb("The number of ahead text buffers to display along with the current one") + .default_value(default.n_ahead) + .mutable_playing() + .build(), + glib::ParamSpecString::builder("separator") + .nick("Separator") + .blurb("Text inserted between each text buffers") + .default_value(Some(&default.separator)) + .mutable_playing() + .build(), // See https://developer.gimp.org/api/2.0/pango/PangoMarkupFormat.html for pango attributes - glib::ParamSpecString::new( - "current-attributes", - "Current attributes", - "Pango span attributes to set on the text from the current buffer", - Some(&default.current_attributes), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING, - ), - glib::ParamSpecString::new( - "ahead-attributes", - "Ahead attributes", - "Pango span attributes to set on the ahead text", - Some(&default.ahead_attributes), - glib::ParamFlags::READWRITE | gst::PARAM_FLAG_MUTABLE_PLAYING, - ), + glib::ParamSpecString::builder("current-attributes") + .nick("Current attributes") + .blurb("Pango span attributes to set on the text from the current buffer") + .default_value(Some(&default.current_attributes)) + .mutable_playing() + .build(), + glib::ParamSpecString::builder("ahead-attributes") + .nick("Ahead attributes") + .blurb("Pango span attributes to set on the ahead text") + .default_value(Some(&default.ahead_attributes)) + .mutable_playing() + .build(), ] }); |