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:
Colin Guthrie 2009-06-17 22:44:02 +01:00
parent 7a7c1fc7f2
commit 514a66e0c8
5 changed files with 10 additions and 15 deletions

View File

@ -95,9 +95,11 @@ void DeviceWidget::onMuteToggleButton() {
}
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() {

View File

@ -44,6 +44,7 @@ public:
virtual void onMuteToggleButton();
virtual void onDefaultToggleButton();
virtual void setDefault(bool isDefault);
sigc::connection timeoutConnection;

View File

@ -214,8 +214,7 @@ void MainWindow::updateSink(const pa_sink_info &info) {
w->setVolume(info.volume);
w->muteToggleButton->set_active(info.mute);
w->defaultToggleButton->set_active(w->name == defaultSinkName);
w->defaultToggleButton->set_sensitive(w->name != defaultSinkName);
w->setDefault(w->name == defaultSinkName);
w->updating = false;
@ -363,8 +362,7 @@ void MainWindow::updateSource(const pa_source_info &info) {
w->setVolume(info.volume);
w->muteToggleButton->set_active(info.mute);
w->defaultToggleButton->set_active(w->name == defaultSourceName);
w->defaultToggleButton->set_sensitive(w->name != defaultSourceName);
w->setDefault(w->name == defaultSourceName);
w->updating = false;
@ -533,8 +531,7 @@ void MainWindow::updateServer(const pa_server_info &info) {
continue;
w->updating = true;
w->defaultToggleButton->set_active(w->name == defaultSinkName);
w->defaultToggleButton->set_sensitive(w->name != defaultSinkName);
w->setDefault(w->name == defaultSinkName);
w->updating = false;
}
@ -546,8 +543,7 @@ void MainWindow::updateServer(const pa_server_info &info) {
continue;
w->updating = true;
w->defaultToggleButton->set_active(w->name == defaultSourceName);
w->defaultToggleButton->set_sensitive(w->name != defaultSourceName);
w->setDefault(w->name == defaultSourceName);
w->updating = false;
}
}

View File

@ -66,8 +66,6 @@ void SinkWidget::onMuteToggleButton() {
void SinkWidget::onDefaultToggleButton() {
pa_operation* o;
DeviceWidget::onDefaultToggleButton();
if (updating)
return;

View File

@ -66,8 +66,6 @@ void SourceWidget::onMuteToggleButton() {
void SourceWidget::onDefaultToggleButton() {
pa_operation* o;
DeviceWidget::onDefaultToggleButton();
if (updating)
return;