Merge pull request #4060 from ErrorNoInternet/group-reveal-by-default

feat(group): add reveal-by-default option
This commit is contained in:
Alexis Rouillard
2026-07-04 00:12:54 +02:00
committed by GitHub
2 changed files with 19 additions and 6 deletions
+14 -6
View File
@@ -62,6 +62,10 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
const bool left_to_right = (drawer_config["transition-left-to-right"].isBool()
? drawer_config["transition-left-to-right"].asBool()
: true);
const bool reveal_by_default =
(drawer_config["reveal-by-default"].isBool() ? drawer_config["reveal-by-default"].asBool()
: false);
click_to_reveal = drawer_config["click-to-reveal"].asBool();
reveal_delay = drawer_config["reveal-delay"].asInt();
@@ -73,10 +77,11 @@ Group::Group(const std::string& name, const std::string& id, const Json::Value&
revealer.set_transition_type(transition_type);
revealer.set_transition_duration(transition_duration);
revealer.set_reveal_child(start_expanded);
if (start_expanded) {
if ((click_to_reveal && reveal_by_default) || start_expanded) {
box.set_state_flags(Gtk::StateFlags::STATE_FLAG_PRELIGHT);
revealer.set_reveal_child(true);
} else {
revealer.set_reveal_child(false);
}
revealer.get_style_context()->add_class("drawer");
@@ -110,11 +115,14 @@ bool Group::handleMouseEnter(GdkEventCrossing* const& e) {
if (reveal_delay > 0) {
if (reveal_timeout_.connected()) {
reveal_timeout_.disconnect();
}
}
reveal_timeout_ = Glib::signal_timeout().connect(
[this]() { show_group(); return false; },
reveal_delay);
[this]() {
show_group();
return false;
},
reveal_delay);
} else {
show_group();
}