After writing the patch I got the idea to check the bug tracker and there was already a patch, although I prefer my formatting of the labels :P.
I splitted my patch into two, as the second one is kinda ugly :) (does not handle the updating flag correctly)
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index b7f7a9b..d79f068 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -794,7 +794,7 @@ void SinkInputWidget::clearMenu() {
void SinkInputWidget::buildMenu() {
for (std::map::iterator i = mainWindow->sinkWidgets.begin(); i != mainWindow->sinkWidgets.end(); ++i) {
SinkMenuItem *m;
- sinkMenuItems[i->second->index] = m = new SinkMenuItem(this, i->second->description.c_str(), i->second->index, i->second->index == sinkIndex);
+ sinkMenuItems[i->second->index] = m = new SinkMenuItem(this, (i->second->name + " (" + i->second->description + ")").c_str(), i->second->index, i->second->index == sinkIndex);
submenu.append(m->menuItem);
}
@@ -1033,7 +1033,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->boldNameLabel->set_text("");
gchar *txt;
- w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s", info.description));
+ w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s (%s)", info.name, info.description));
g_free(txt);
w->iconImage->set_from_icon_name("audio-card", Gtk::ICON_SIZE_SMALL_TOOLBAR);
@@ -1175,7 +1175,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->boldNameLabel->set_text("");
gchar *txt;
- w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s", info.description));
+ w->nameLabel->set_markup(txt = g_markup_printf_escaped("%s (%s)", info.name, info.description));
g_free(txt);
w->iconImage->set_from_icon_name("audio-input-microphone", Gtk::ICON_SIZE_SMALL_TOOLBAR);
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index d79f068..69dba03 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -1232,6 +1232,14 @@ finish:
icon->set_from_icon_name(t, Gtk::ICON_SIZE_SMALL_TOOLBAR);
}
+void sinkName_cb(pa_context *, const pa_module_info *i, int eol, void *userdata) {
+ if(i == NULL) {
+ return;
+ }
+ SinkInputWidget *w = static_cast(userdata);
+ w->nameLabel->set_label(g_markup_printf_escaped("%s (%s)", i->name, w->nameLabel->get_label().c_str()));
+}
+
void MainWindow::updateSinkInput(const pa_sink_input_info &info) {
SinkInputWidget *w;
bool is_new = false;
@@ -1265,7 +1273,11 @@ void MainWindow::updateSinkInput(const pa_sink_input_info &info) {
g_free(txt);
} else {
w->boldNameLabel->set_text("");
- w->nameLabel->set_label(info.name);
+ w->nameLabel->set_label(info.name);
+ if(info.owner_module != PA_INVALID_INDEX) {
+ g_debug(_("num: %i"), info.owner_module);
+ pa_context_get_module_info(context, info.owner_module, sinkName_cb, w);
+ }
}
setIconFromProplist(w->iconImage, info.proplist, "audio-card");
@@ -1311,8 +1323,12 @@ void MainWindow::updateSourceOutput(const pa_source_output_info &info) {
w->nameLabel->set_markup(txt = g_markup_printf_escaped(": %s", info.name));
g_free(txt);
} else {
- w->boldNameLabel->set_text("");
- w->nameLabel->set_label(info.name);
+ w->boldNameLabel->set_text("");
+ w->nameLabel->set_label(info.name);
+ if(info.owner_module != PA_INVALID_INDEX) {
+ g_debug(_("num: %i"), info.owner_module);
+ pa_context_get_module_info(context, info.owner_module, sinkName_cb, w);
+ }
}
setIconFromProplist(w->iconImage, info.proplist, "audio-input-microphone");
And here's how it looks:
No comments:
Post a Comment