[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [plasma-pa] [Bug 365723] Disconnected pulseaudio outputs not hidden in drop-down list
From:       via KDE Bugzilla <bugzilla_noreply () kde ! org>
Date:       2016-07-21 19:30:45
Message-ID: bug-365723-17878-V4ME9cJLQg () http ! bugs ! kde ! org/
[Download RAW message or body]

https://bugs.kde.org/show_bug.cgi?id=365723

--- Comment #5 from bernie@codewiz.org ---
kcm_pulseaudio uses a loop like this to fill-in the profiles drop-down:

    for (auto **it = info->profiles2; it && *it != nullptr; ++it) {
        Profile *profile = new Profile(this);
        profile->setInfo(*it);
        m_profiles.append(profile);
        if (info->active_profile2 == *it) {
            m_activeProfileIndex = m_profiles.length() - 1;
        }
    }

I added some logging and found that checking (*it)->available is not enough to
tell if a profile should be enabled. It seems that all profiles have available
== 1.

Next, I looked at the corresponding code in pavucontrol: for each profile, it
looks at all the ports. If the profile appears in port.profiles, it checks if
the port is in state PA_PORT_AVAILABLE_NO:

    for (std::set<pa_card_profile_info2>::iterator profileIt =
profile_priorities.begin(); profileIt != profile_priorities.end(); ++profileIt)
{
        bool hasNo = false, hasOther = false;
        std::map<Glib::ustring, PortInfo>::iterator portIt;
        Glib::ustring desc = profileIt->description;

        for (portIt = w->ports.begin(); portIt != w->ports.end(); portIt++) {
            PortInfo port = portIt->second;

            if (std::find(port.profiles.begin(), port.profiles.end(),
profileIt->name) == port.profiles.end())
                continue;

            if (port.available == PA_PORT_AVAILABLE_NO)
                hasNo = true;
            else {
                hasOther = true;
                break;
            }
        }
        if (hasNo && !hasOther)
            desc += _(" (unplugged)");

        if (!profileIt->available)
            desc += _(" (unavailable)");

       
w->profiles.push_back(std::pair<Glib::ustring,Glib::ustring>(profileIt->name,
desc));
    }

The "hasNo && !hasOther" thing is pretty confusing. I guess what they really
meant is: "mark the profile as unplugged if all its ports are in state
PA_PORT_AVAILABLE_NO".

So we could do something similar in plasma-pa... I would prefer not to see the
unplugged profiles at all in the list (like Gnome and Cinnamon do it).
Grayed-out would also work, but it seems more clutter.

-- 
You are receiving this mail because:
You are watching all bug changes.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic