[pulseaudio-discuss] [PATCH v2 2/2 pavucontrol] mainwindow: Show only unplugged profiles.
poljar (Damir Jelić)
poljarinho at gmail.com
Thu Nov 15 15:12:59 PST 2012
From: "poljar (Damir Jelić)" <poljarinho at gmail.com>
---
src/mainwindow.cc | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 63e02e8..5a1c8f4 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -332,7 +332,7 @@ void MainWindow::updateCard(const pa_card_info &info) {
w->profiles.clear();
for (std::set<pa_card_profile_info>::iterator profileIt = profile_priorities.begin(); profileIt != profile_priorities.end(); ++profileIt) {
- bool hasYes = false, hasNo = false, hasOther = false;
+ bool hasNo = false, hasOther = false;
std::map<Glib::ustring, PortInfo>::iterator portIt;
Glib::ustring desc = profileIt->description;
@@ -342,22 +342,15 @@ void MainWindow::updateCard(const pa_card_info &info) {
if (std::find(port.profiles.begin(), port.profiles.end(), profileIt->name) == port.profiles.end())
continue;
- switch (port.available) {
- case PA_PORT_AVAILABLE_YES:
- hasYes = true;
- break;
- case PA_PORT_AVAILABLE_NO:
- hasNo = true;
- break;
- default:
- hasOther = true;
- break;
+ if (port.available == PA_PORT_AVAILABLE_NO)
+ hasNo = true;
+ else {
+ hasOther = true;
+ break;
}
}
- if (hasNo && !hasYes && !hasOther)
+ if (hasNo && !hasOther)
desc += _(" (unplugged)");
- else if (hasYes && !hasNo && !hasOther)
- desc += _(" (plugged in)");
w->profiles.push_back(std::pair<Glib::ustring,Glib::ustring>(profileIt->name, desc));
}
--
1.8.0
More information about the pulseaudio-discuss
mailing list