Skip to content

Commit

Permalink
Fix type name in set-default-configured-node-name call.
Browse files Browse the repository at this point in the history
  • Loading branch information
saivert committed Apr 29, 2024
1 parent ac72bdf commit 3564d22
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions src/ui/sinkbox.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ use gtk::{prelude::*, subclass::prelude::*};
use std::cell::Cell;
use wireplumber as wp;
use super::volumebox::PwVolumeBoxExt;
use crate::{backend::NodeType, pwvucontrol_info};
use crate::ui::PwRouteDropDown;

mod imp {
use crate::pwvucontrol_info;

use super::*;

Expand Down Expand Up @@ -82,17 +82,27 @@ mod imp {
let obj = self.obj();
let parent: &PwVolumeBox = obj.upcast_ref();
let node = parent.node_object().expect("nodeobj");
let node_name: String = node.node_property("node.name");
let node_name: String = if _togglebutton.is_active() {
node.node_property("node.name")
} else {
"".to_string()
};

let manager = PwvucontrolManager::default();

let core = manager.imp().wp_core.get().expect("Core");
let defaultnodesapi =
wp::plugin::Plugin::find(core, "default-nodes-api").expect("Get mixer-api");

let type_name = match node.nodetype() {
NodeType::Sink => "Audio/Sink",
NodeType::Source => "Audio/Source",
_ => unreachable!()
};

let result: bool = defaultnodesapi.emit_by_name(
"set-default-configured-node-name",
&[&"Audio/Sink", &node_name],
&[&type_name, &node_name],
);
wp::info!("set-default-configured-node-name result: {result:?}");
}
Expand Down

0 comments on commit 3564d22

Please sign in to comment.