Skip to content

Commit

Permalink
Rename row_data property to approriate name
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed Dec 23, 2023
1 parent 9bca20b commit 88ada60
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/ui/channelbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod imp {
#[properties(wrapper_type = super::PwChannelBox)]
pub struct PwChannelBox {
#[property(get, set, construct_only)]
row_data: RefCell<Option<PwChannelObject>>,
channel_object: RefCell<Option<PwChannelObject>>,

// Template widgets
#[template_child]
Expand Down Expand Up @@ -53,7 +53,7 @@ mod imp {

self.parent_constructed();

let item = self.row_data.borrow();
let item = self.channel_object.borrow();
let item = item.as_ref().cloned().unwrap();

item.bind_property("volume", &self.scale.adjustment(), "value")
Expand Down Expand Up @@ -86,7 +86,7 @@ glib::wrapper! {
impl PwChannelBox {
pub(crate) fn new(channelobj: &PwChannelObject) -> Self {
glib::Object::builder()
.property("row-data", channelobj)
.property("channel-object", channelobj)
.build()
}
}
12 changes: 4 additions & 8 deletions src/ui/outputbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ mod imp {

let obj = self.obj();
let parent: &PwVolumeBox = obj.upcast_ref();
let item = parent.row_data().expect("nodeobj");
let item = parent.node_object().expect("nodeobj");

parent.add_default_node_change_handler(clone!(@weak self as widget => move || {
widget.obj().update_output_device_dropdown();
Expand Down Expand Up @@ -93,13 +93,9 @@ glib::wrapper! {
}

impl PwOutputBox {
pub(crate) fn new(row_data: &impl glib::IsA<PwNodeObject>) -> Self {
pub(crate) fn new(node_object: &impl glib::IsA<PwNodeObject>) -> Self {
glib::Object::builder()
.property("row-data", row_data)
// .property(
// "channelmodel",
// gio::ListStore::new::<crate::pwchannelobject::PwChannelObject>(),
// )
.property("node-object", node_object)
.build()
}

Expand All @@ -122,7 +118,7 @@ impl PwOutputBox {
};
output_dropdown.set_default_text(&string);

let item = parent.row_data().expect("row_data in pwvolumebox");
let item = parent.node_object().expect("nodeobj");

if let Some(deftarget) = item.default_target() {
// let model: gio::ListModel = imp
Expand Down
8 changes: 4 additions & 4 deletions src/ui/sinkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ mod imp {
}
let obj = self.obj();
let parent: &PwVolumeBox = obj.upcast_ref();
let node = parent.row_data().expect("row data set on volumebox");
let node = parent.node_object().expect("nodeobj");
let node_name: String = node.node_property("node.name");

let manager = PwvucontrolManager::default();
Expand All @@ -92,16 +92,16 @@ glib::wrapper! {
}

impl PwSinkBox {
pub(crate) fn new(row_data: &impl glib::IsA<PwNodeObject>) -> Self {
pub(crate) fn new(node_object: &impl glib::IsA<PwNodeObject>) -> Self {
glib::Object::builder()
.property("row-data", row_data)
.property("node-object", node_object)
.build()
}

pub(crate) fn default_node_changed(&self) {
let imp = self.imp();
let parent: &PwVolumeBox = self.upcast_ref();
let node = parent.row_data().expect("nodeobj");
let node = parent.node_object().expect("nodeobj");
let id = parent.imp().default_node.get();

imp.block_default_node_toggle_signal.set(true);
Expand Down
8 changes: 4 additions & 4 deletions src/ui/volumebox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod imp {
#[properties(wrapper_type = super::PwVolumeBox)]
pub struct PwVolumeBox {
#[property(get, set, construct_only)]
pub(super) row_data: RefCell<Option<PwNodeObject>>,
pub(super) node_object: RefCell<Option<PwNodeObject>>,

// #[property(get, set, construct_only)]
channelmodel: OnceCell<gio::ListStore>,
Expand Down Expand Up @@ -96,7 +96,7 @@ mod imp {

self.channelmodel.set(gio::ListStore::new::<PwChannelObject>()).expect("channelmodel not already set");

let item = self.row_data.borrow();
let item = self.node_object.borrow();
let item = item.as_ref().cloned().unwrap();

self.icon.set_icon_name(Some(&item.iconname()));
Expand Down Expand Up @@ -312,9 +312,9 @@ glib::wrapper! {
}

impl PwVolumeBox {
pub(crate) fn new(row_data: &impl glib::IsA<PwNodeObject>) -> Self {
pub(crate) fn new(channel_object: &impl glib::IsA<PwNodeObject>) -> Self {
glib::Object::builder()
.property("row-data", row_data)
.property("node-object", channel_object)
.property("channelmodel", gio::ListStore::new::<PwChannelObject>())
.build()
}
Expand Down

0 comments on commit 88ada60

Please sign in to comment.