Set monitor section action sensitivity

When showing monitor controls in the application bars
they can be always visible regardless if a monitor-section
exists or not. Furthermore, the main application session menu
unconditionally exposes these actions.

This makes the controls insensitive when no monitor sections
is present.
This commit is contained in:
Robin Gareus 2025-01-02 17:55:15 +01:00
parent 845ad12090
commit 1097108aee
No known key found for this signature in database
GPG key ID: A090BCE02CF57F04

View file

@ -490,6 +490,7 @@ MonitorSection::MonitorSection ()
_tearoff->tearoff_window().set_title (X_("Monitor"));
_tearoff->tearoff_window().signal_key_press_event().connect (sigc::bind (sigc::ptr_fun (relay_key_press), (Gtk::Window*) &_tearoff->tearoff_window()), false);
unassign_controllables ();
update_processor_box ();
_ui_initialized = true;
@ -1217,6 +1218,23 @@ MonitorSection::unassign_controllables ()
dim_display->set_controllable (none);
solo_boost_control->set_controllable (none);
solo_boost_display->set_controllable (none);
Glib::RefPtr<ToggleAction> tact;
tact = ActionManager::get_toggle_action (X_("Monitor Section"), X_("monitor-dim-all"));
if (tact) {
tact->set_active (false);
tact->set_sensitive (false);
}
tact = ActionManager::get_toggle_action (X_("Monitor Section"), X_("monitor-mono"));
if (tact) {
tact->set_active (false);
tact->set_sensitive (false);
}
tact = ActionManager::get_toggle_action (X_("Monitor Section"), X_("monitor-cut-all"));
if (tact) {
tact->set_active (false);
tact->set_sensitive (false);
}
}
void
@ -1241,6 +1259,21 @@ MonitorSection::assign_controllables ()
dim_display->set_controllable (_monitor->dim_level_control ());
solo_boost_control->set_controllable (_monitor->solo_boost_control ());
solo_boost_display->set_controllable (_monitor->solo_boost_control ());
Glib::RefPtr<Action> act;
act = ActionManager::get_action (X_("Monitor Section"), X_("monitor-dim-all"));
if (act) {
act->set_sensitive (true);
}
act = ActionManager::get_action (X_("Monitor Section"), X_("monitor-mono"));
if (act) {
act->set_sensitive (true);
}
act = ActionManager::get_action (X_("Monitor Section"), X_("monitor-cut-all"));
if (act) {
act->set_sensitive (true);
}
}
string