modules: Set style-context on button
Fixes issue where the class parameters in style.css would have no effect. The CSS now references the GtkButton instead of the GtkLabel. Removing all style-classes from the custom module GtkButton however removes any properties set via style.css. Thus, the default classes 'flat' and 'text-button' are added on every update of these modules.
This commit is contained in:
@ -142,10 +142,10 @@ std::string AButton::getState(uint8_t value, bool lesser) {
|
||||
std::string valid_state;
|
||||
for (auto const& state : states) {
|
||||
if ((lesser ? value <= state.second : value >= state.second) && valid_state.empty()) {
|
||||
label_->get_style_context()->add_class(state.first);
|
||||
button_.get_style_context()->add_class(state.first);
|
||||
valid_state = state.first;
|
||||
} else {
|
||||
label_->get_style_context()->remove_class(state.first);
|
||||
button_.get_style_context()->remove_class(state.first);
|
||||
}
|
||||
}
|
||||
return valid_state;
|
||||
|
||||
Reference in New Issue
Block a user