Skip to content

Commit

Permalink
Simplify properties, use non-nullable strings
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed Dec 25, 2023
1 parent 8d5acc0 commit 090883d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/backend/pwnodeobject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ pub mod imp {
#[properties(wrapper_type = super::PwNodeObject)]
pub struct PwNodeObject {
#[property(get, set)]
name: RefCell<Option<String>>,
name: RefCell<String>,
#[property(get, set)]
description: RefCell<Option<String>>,
description: RefCell<String>,
#[property(get, set)]
formatstr: RefCell<Option<String>>,
formatstr: RefCell<String>,
#[property(get, set)]
boundid: Cell<u32>,
#[property(get, set)]
Expand All @@ -56,7 +56,7 @@ pub mod imp {
iconname: RefCell<String>,

pub(super) channel_volumes: RefCell<Vec<f32>>,
#[property(get, set, construct_only, builder(NodeType::Undefined))]
#[property(get, builder(NodeType::Undefined))]
nodetype: Cell<NodeType>,

#[property(get)]
Expand Down
4 changes: 2 additions & 2 deletions src/ui/output_dropdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod imp {
move |_: Option<glib::Object>, item: Option<glib::Object>| {
if let Some(item) = item {
if let Some(item) = item.downcast_ref::<PwNodeObject>() {
return item.name();
return Some(item.name());
}
if let Some(item) = item.downcast_ref::<gtk::StringObject>() {
return Some(item.string().to_string());
Expand Down Expand Up @@ -109,7 +109,7 @@ mod imp {
gtk::Expression::NONE,
closure_local!(move |item: glib::Object| {
if let Some(item) = item.downcast_ref::<PwNodeObject>() {
item.name()
Some(item.name())
} else {
item.downcast_ref::<gtk::StringObject>().map(|item| item.string().to_string())
}
Expand Down
2 changes: 1 addition & 1 deletion src/ui/outputbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
Expand Down

0 comments on commit 090883d

Please sign in to comment.