From 3564d22e54e61e66e77cb34cb8856feb38b014a8 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Mon, 29 Apr 2024 20:37:55 +0200 Subject: [PATCH] Fix type name in set-default-configured-node-name call. --- src/ui/sinkbox.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/ui/sinkbox.rs b/src/ui/sinkbox.rs index 89410cf..7aaf163 100644 --- a/src/ui/sinkbox.rs +++ b/src/ui/sinkbox.rs @@ -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::*; @@ -82,7 +82,11 @@ 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(); @@ -90,9 +94,15 @@ mod imp { 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:?}"); }