diff options
author | Simon Rettberg | 2022-05-16 16:13:59 +0200 |
---|---|---|
committer | Simon Rettberg | 2022-05-16 16:13:59 +0200 |
commit | 844ee812d60fafe0edbe5ac577f3809fb7549aa2 (patch) | |
tree | 4480eee8747b2df254564fa4f0b441956b8d2fa3 | |
parent | Make pressed buttons light-green (diff) | |
download | pavucontrol-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.
-rw-r--r-- | src/pavucontrol.cc | 10 | ||||
-rw-r--r-- | src/pavucontrol.h | 2 | ||||
-rw-r--r-- | src/sinkwidget.cc | 1 | ||||
-rw-r--r-- | src/sourcewidget.cc | 1 |
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() { |