refactor(modules): migrate audio/network/power modules to ALabel tooltip helpers

Migrate network, pulseaudio, wireplumber, jack and power_profiles_daemon
to the generic ALabel tooltip helpers:

- jack and power-profiles-daemon use updateLabelAndTooltip() since their
  label/tooltip share a single arg set and a format-string tooltip default.
- network, pulseaudio and wireplumber keep their rich in-module format
  selection but build a single fmt arg store, render the label/tooltip
  through the dedup-aware setLabelMarkup()/setTooltipMarkup() setters and
  resolveTooltipFormat(), preserving their custom fallbacks (label text,
  sink/node description) and visibility handling exactly.
This commit is contained in:
Alex
2026-07-04 00:04:47 +02:00
parent a91dcbe595
commit 014c95a9fe
5 changed files with 85 additions and 117 deletions
+8 -12
View File
@@ -187,18 +187,14 @@ void PowerProfilesDaemon::switchToProfile(std::string const& str) {
auto PowerProfilesDaemon::update() -> void {
if (connected_ && activeProfile_ != availableProfiles_.end()) {
auto profile = (*activeProfile_);
// Set label
fmt::dynamic_format_arg_store<fmt::format_context> store;
store.push_back(fmt::arg("profile", profile.name));
// Legacy placeholder, kept for backward compatibility with existing configs.
store.push_back(fmt::arg("driver", profile.driver));
store.push_back(fmt::arg("cpu_driver", profile.cpuDriver));
store.push_back(fmt::arg("platform_driver", profile.platformDriver));
store.push_back(fmt::arg("icon", getIcon(0, profile.name)));
label_.set_markup(fmt::vformat(format_, store));
if (tooltipEnabled()) {
label_.set_tooltip_markup(fmt::vformat(tooltipFormat_, store));
}
// Set label and tooltip
updateLabelAndTooltip(format_, tooltipFormat_, fmt::arg("profile", profile.name),
// Legacy placeholder, kept for backward compatibility with existing
// configs.
fmt::arg("driver", profile.driver),
fmt::arg("cpu_driver", profile.cpuDriver),
fmt::arg("platform_driver", profile.platformDriver),
fmt::arg("icon", getIcon(0, profile.name)));
// Set CSS class
if (!currentStyle_.empty()) {