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 /generic/sodium | |
parent | 84f6484140098826b3f074d806e0eb052198df43 (diff) |
plugins: Simplify code using ParamSpecBuilder
Diffstat (limited to 'generic/sodium')
-rw-r--r-- | generic/sodium/src/decrypter/imp.rs | 23 | ||||
-rw-r--r-- | generic/sodium/src/encrypter/imp.rs | 38 |
2 files changed, 24 insertions, 37 deletions
diff --git a/generic/sodium/src/decrypter/imp.rs b/generic/sodium/src/decrypter/imp.rs index 333929fec..9e71d9ad7 100644 --- a/generic/sodium/src/decrypter/imp.rs +++ b/generic/sodium/src/decrypter/imp.rs @@ -597,20 +597,15 @@ impl ObjectImpl for Decrypter { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| { vec![ - glib::ParamSpecBoxed::new( - "receiver-key", - "Receiver Key", - "The private key of the Reeiver", - glib::Bytes::static_type(), - glib::ParamFlags::READWRITE, - ), - glib::ParamSpecBoxed::new( - "sender-key", - "Sender Key", - "The public key of the Sender", - glib::Bytes::static_type(), - glib::ParamFlags::WRITABLE, - ), + glib::ParamSpecBoxed::builder("receiver-key", glib::Bytes::static_type()) + .nick("Receiver Key") + .blurb("The private key of the Receiver") + .build(), + glib::ParamSpecBoxed::builder("sender-key", glib::Bytes::static_type()) + .nick("Sender Key") + .blurb("The public key of the Sender") + .write_only() + .build(), ] }); diff --git a/generic/sodium/src/encrypter/imp.rs b/generic/sodium/src/encrypter/imp.rs index 9bcd5691a..e35b7dfa1 100644 --- a/generic/sodium/src/encrypter/imp.rs +++ b/generic/sodium/src/encrypter/imp.rs @@ -389,29 +389,21 @@ impl ObjectImpl for Encrypter { fn properties() -> &'static [glib::ParamSpec] { static PROPERTIES: Lazy<Vec<glib::ParamSpec>> = Lazy::new(|| { vec![ - glib::ParamSpecBoxed::new( - "receiver-key", - "Receiver Key", - "The public key of the Receiver", - glib::Bytes::static_type(), - glib::ParamFlags::READWRITE, - ), - glib::ParamSpecBoxed::new( - "sender-key", - "Sender Key", - "The private key of the Sender", - glib::Bytes::static_type(), - glib::ParamFlags::WRITABLE, - ), - glib::ParamSpecUInt::new( - "block-size", - "Block Size", - "The block-size of the chunks", - 1024, - std::u32::MAX, - 32768, - glib::ParamFlags::READWRITE, - ), + glib::ParamSpecBoxed::builder("receiver-key", glib::Bytes::static_type()) + .nick("Receiver Key") + .blurb("The public key of the Receiver") + .build(), + glib::ParamSpecBoxed::builder("sender-key", glib::Bytes::static_type()) + .nick("Sender Key") + .blurb("The private key of the Sender") + .write_only() + .build(), + glib::ParamSpecUInt::builder("block-size") + .nick("Block Size") + .blurb("The block-size of the chunks") + .minimum(1024) + .default_value(32768) + .build(), ] }); |