From 090883d8951202f4fd1b1461730654b412f350df Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Mon, 25 Dec 2023 16:06:41 +0100 Subject: [PATCH] Simplify properties, use non-nullable strings --- src/backend/pwnodeobject.rs | 8 ++++---- src/ui/output_dropdown.rs | 4 ++-- src/ui/outputbox.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/backend/pwnodeobject.rs b/src/backend/pwnodeobject.rs index e5c8af5..b4a8cef 100644 --- a/src/backend/pwnodeobject.rs +++ b/src/backend/pwnodeobject.rs @@ -37,11 +37,11 @@ pub mod imp { #[properties(wrapper_type = super::PwNodeObject)] pub struct PwNodeObject { #[property(get, set)] - name: RefCell>, + name: RefCell, #[property(get, set)] - description: RefCell>, + description: RefCell, #[property(get, set)] - formatstr: RefCell>, + formatstr: RefCell, #[property(get, set)] boundid: Cell, #[property(get, set)] @@ -56,7 +56,7 @@ pub mod imp { iconname: RefCell, pub(super) channel_volumes: RefCell>, - #[property(get, set, construct_only, builder(NodeType::Undefined))] + #[property(get, builder(NodeType::Undefined))] nodetype: Cell, #[property(get)] diff --git a/src/ui/output_dropdown.rs b/src/ui/output_dropdown.rs index dc0b6bf..1e7ee7f 100644 --- a/src/ui/output_dropdown.rs +++ b/src/ui/output_dropdown.rs @@ -75,7 +75,7 @@ mod imp { move |_: Option, item: Option| { if let Some(item) = item { if let Some(item) = item.downcast_ref::() { - return item.name(); + return Some(item.name()); } if let Some(item) = item.downcast_ref::() { return Some(item.string().to_string()); @@ -109,7 +109,7 @@ mod imp { gtk::Expression::NONE, closure_local!(move |item: glib::Object| { if let Some(item) = item.downcast_ref::() { - item.name() + Some(item.name()) } else { item.downcast_ref::().map(|item| item.string().to_string()) } diff --git a/src/ui/outputbox.rs b/src/ui/outputbox.rs index fe01c4b..b47ab79 100644 --- a/src/ui/outputbox.rs +++ b/src/ui/outputbox.rs @@ -110,7 +110,7 @@ impl PwOutputBox { let id = parent.imp().default_node.get(); let string = if let Ok(node) = sinkmodel.get_node(id) { - format!("Default ({})", node.name().unwrap()) + format!("Default ({})", node.name()) } else { "Default".to_string() };