refactor(Window): simpler conditions
This commit is contained in:
parent
2d9bcb1a2d
commit
717a07d584
|
@ -43,21 +43,19 @@ void Window::onEvent(const struct Ipc::ipc_response& res) {
|
||||||
|
|
||||||
void Window::onCmd(const struct Ipc::ipc_response& res) {
|
void Window::onCmd(const struct Ipc::ipc_response& res) {
|
||||||
auto [nb, id, name, app_id] = getFocusedNode(res.payload);
|
auto [nb, id, name, app_id] = getFocusedNode(res.payload);
|
||||||
if (nb == 0) {
|
|
||||||
bar_.window.get_style_context()->add_class("empty");
|
|
||||||
} else {
|
|
||||||
bar_.window.get_style_context()->remove_class("empty");
|
|
||||||
}
|
|
||||||
if (!app_id_.empty()) {
|
if (!app_id_.empty()) {
|
||||||
bar_.window.get_style_context()->remove_class(app_id_);
|
bar_.window.get_style_context()->remove_class(app_id_);
|
||||||
}
|
}
|
||||||
if (nb == 1) {
|
if (nb == 0) {
|
||||||
|
bar_.window.get_style_context()->add_class("empty");
|
||||||
|
} else if (nb == 1) {
|
||||||
bar_.window.get_style_context()->add_class("solo");
|
bar_.window.get_style_context()->add_class("solo");
|
||||||
if (!app_id.empty()) {
|
if (!app_id.empty()) {
|
||||||
bar_.window.get_style_context()->add_class(app_id);
|
bar_.window.get_style_context()->add_class(app_id);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
bar_.window.get_style_context()->remove_class("solo");
|
bar_.window.get_style_context()->remove_class("solo");
|
||||||
|
bar_.window.get_style_context()->remove_class("empty");
|
||||||
}
|
}
|
||||||
app_id_ = app_id;
|
app_id_ = app_id;
|
||||||
if (windowId_ != id || window_ != name) {
|
if (windowId_ != id || window_ != name) {
|
||||||
|
|
Loading…
Reference in New Issue