feat: move name and classes from label_ to box_

This commit is contained in:
Azazel 2024-02-26 04:07:03 +00:00
parent 3a5aa5ee83
commit 16aced7f9f
1 changed files with 10 additions and 7 deletions

View File

@ -9,17 +9,20 @@ AIconLabel::AIconLabel(const Json::Value &config, const std::string &name, const
bool enable_click, bool enable_scroll)
: ALabel(config, name, id, format, interval, ellipsize, enable_click, enable_scroll) {
event_box_.remove();
label_.unset_name();
label_.get_style_context()->remove_class(MODULE_CLASS);
box_.get_style_context()->add_class(MODULE_CLASS);
if (!id.empty()) {
label_.get_style_context()->remove_class(id);
box_.get_style_context()->add_class(id);
}
box_.set_orientation(Gtk::Orientation::ORIENTATION_HORIZONTAL);
// set aesthetic default spacing
int spacing = config_["icon-spacing"].isInt() ? config_["icon-spacing"].asInt() : -5;
box_.set_spacing(spacing);
int margin_top = config_["margin-top"].isInt() ? config_["margin-top"].asInt() : 6;
box_.set_margin_top(margin_top);
box_.set_name(name);
box_.add(image_);
box_.add(label_);
event_box_.add(box_);
}