summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSimon Rettberg2022-05-16 16:13:59 +0200
committerSimon Rettberg2022-05-16 16:13:59 +0200
commit844ee812d60fafe0edbe5ac577f3809fb7549aa2 (patch)
tree4480eee8747b2df254564fa4f0b441956b8d2fa3 /src
parentMake pressed buttons light-green (diff)
downloadpavucontrol-slx-844ee812d60fafe0edbe5ac577f3809fb7549aa2.tar.gz
pavucontrol-slx-844ee812d60fafe0edbe5ac577f3809fb7549aa2.tar.xz
pavucontrol-slx-844ee812d60fafe0edbe5ac577f3809fb7549aa2.zip
Update default buttons after click
The actual state might differ from the desired state after clicking, and we don't seem to get any callback from the PA-server in that case, so do a manual refresh.
Diffstat (limited to 'src')
-rw-r--r--src/pavucontrol.cc10
-rw-r--r--src/pavucontrol.h2
-rw-r--r--src/sinkwidget.cc1
-rw-r--r--src/sourcewidget.cc1
4 files changed, 14 insertions, 0 deletions
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index 4b1d502..4e62f33 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -665,6 +665,16 @@ pa_context* get_context(void) {
return context;
}
+void update_default_sinks(MainWindow *w) {
+ pa_operation *o;
+ if (!(o = pa_context_get_server_info(context, server_info_cb, w))) {
+ show_error(QObject::tr("pa_context_get_server_info() failed").toUtf8().constData());
+ return;
+ }
+ pa_operation_unref(o);
+ n_outstanding++;
+}
+
void connectToPulse(void) {
pa_proplist *proplist = pa_proplist_new();
pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, QObject::tr("PulseAudio Volume Control").toUtf8().constData());
diff --git a/src/pavucontrol.h b/src/pavucontrol.h
index 925be4f..3d7fa88 100644
--- a/src/pavucontrol.h
+++ b/src/pavucontrol.h
@@ -61,6 +61,8 @@ enum SourceType {
SOURCE_MONITOR,
};
+class MainWindow;
+void update_default_sinks(MainWindow *w);
pa_context* get_context(void);
void show_error(const char *txt);
diff --git a/src/sinkwidget.cc b/src/sinkwidget.cc
index 7bec630..f404a0b 100644
--- a/src/sinkwidget.cc
+++ b/src/sinkwidget.cc
@@ -111,6 +111,7 @@ void SinkWidget::onDefaultToggleButton() {
return;
}
pa_operation_unref(o);
+ update_default_sinks(mpMainWindow);
}
void SinkWidget::onPortChange() {
diff --git a/src/sourcewidget.cc b/src/sourcewidget.cc
index cecd893..6dbfeea 100644
--- a/src/sourcewidget.cc
+++ b/src/sourcewidget.cc
@@ -65,6 +65,7 @@ void SourceWidget::onDefaultToggleButton() {
return;
}
pa_operation_unref(o);
+ update_default_sinks(mpMainWindow);
}
void SourceWidget::onPortChange() {