Do not disable the default button when it's set.
I reworked the way this was done so we can easily re-enable this as I think it's clearer when it's inactive (the difference between toggled and not toggled is pretty minor). With this abstraction we could reset the tooltip etc. too.
This commit is contained in:
parent
7a7c1fc7f2
commit
514a66e0c8
|
@ -95,9 +95,11 @@ void DeviceWidget::onMuteToggleButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceWidget::onDefaultToggleButton() {
|
void DeviceWidget::onDefaultToggleButton() {
|
||||||
/* Prevent the button being untoggled */
|
}
|
||||||
if (defaultToggleButton->get_active())
|
|
||||||
defaultToggleButton->set_sensitive(false);
|
void DeviceWidget::setDefault(bool isDefault) {
|
||||||
|
defaultToggleButton->set_active(isDefault);
|
||||||
|
/*defaultToggleButton->set_sensitive(!isDefault);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeviceWidget::timeoutEvent() {
|
bool DeviceWidget::timeoutEvent() {
|
||||||
|
|
|
@ -44,6 +44,7 @@ public:
|
||||||
|
|
||||||
virtual void onMuteToggleButton();
|
virtual void onMuteToggleButton();
|
||||||
virtual void onDefaultToggleButton();
|
virtual void onDefaultToggleButton();
|
||||||
|
virtual void setDefault(bool isDefault);
|
||||||
|
|
||||||
sigc::connection timeoutConnection;
|
sigc::connection timeoutConnection;
|
||||||
|
|
||||||
|
|
|
@ -214,8 +214,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
|
||||||
w->setVolume(info.volume);
|
w->setVolume(info.volume);
|
||||||
w->muteToggleButton->set_active(info.mute);
|
w->muteToggleButton->set_active(info.mute);
|
||||||
|
|
||||||
w->defaultToggleButton->set_active(w->name == defaultSinkName);
|
w->setDefault(w->name == defaultSinkName);
|
||||||
w->defaultToggleButton->set_sensitive(w->name != defaultSinkName);
|
|
||||||
|
|
||||||
w->updating = false;
|
w->updating = false;
|
||||||
|
|
||||||
|
@ -363,8 +362,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
|
||||||
w->setVolume(info.volume);
|
w->setVolume(info.volume);
|
||||||
w->muteToggleButton->set_active(info.mute);
|
w->muteToggleButton->set_active(info.mute);
|
||||||
|
|
||||||
w->defaultToggleButton->set_active(w->name == defaultSourceName);
|
w->setDefault(w->name == defaultSourceName);
|
||||||
w->defaultToggleButton->set_sensitive(w->name != defaultSourceName);
|
|
||||||
|
|
||||||
w->updating = false;
|
w->updating = false;
|
||||||
|
|
||||||
|
@ -533,8 +531,7 @@ void MainWindow::updateServer(const pa_server_info &info) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->updating = true;
|
w->updating = true;
|
||||||
w->defaultToggleButton->set_active(w->name == defaultSinkName);
|
w->setDefault(w->name == defaultSinkName);
|
||||||
w->defaultToggleButton->set_sensitive(w->name != defaultSinkName);
|
|
||||||
|
|
||||||
w->updating = false;
|
w->updating = false;
|
||||||
}
|
}
|
||||||
|
@ -546,8 +543,7 @@ void MainWindow::updateServer(const pa_server_info &info) {
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
w->updating = true;
|
w->updating = true;
|
||||||
w->defaultToggleButton->set_active(w->name == defaultSourceName);
|
w->setDefault(w->name == defaultSourceName);
|
||||||
w->defaultToggleButton->set_sensitive(w->name != defaultSourceName);
|
|
||||||
w->updating = false;
|
w->updating = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,8 +66,6 @@ void SinkWidget::onMuteToggleButton() {
|
||||||
void SinkWidget::onDefaultToggleButton() {
|
void SinkWidget::onDefaultToggleButton() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
|
|
||||||
DeviceWidget::onDefaultToggleButton();
|
|
||||||
|
|
||||||
if (updating)
|
if (updating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,6 @@ void SourceWidget::onMuteToggleButton() {
|
||||||
void SourceWidget::onDefaultToggleButton() {
|
void SourceWidget::onDefaultToggleButton() {
|
||||||
pa_operation* o;
|
pa_operation* o;
|
||||||
|
|
||||||
DeviceWidget::onDefaultToggleButton();
|
|
||||||
|
|
||||||
if (updating)
|
if (updating)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue