Formatting of close button
This commit is contained in:
parent
a82c0a5577
commit
e9055e74d9
1 changed files with 20 additions and 13 deletions
|
|
@ -45,25 +45,32 @@ impl ObjectImpl for NotificationWidgetInner {
|
||||||
};
|
};
|
||||||
|
|
||||||
let box_ = cascade! {
|
let box_ = cascade! {
|
||||||
gtk4::Box::new(gtk4::Orientation::Horizontal, 0);
|
gtk4::Box::new(gtk4::Orientation::Horizontal, 6);
|
||||||
..set_parent(obj);
|
..set_parent(obj);
|
||||||
..append(&cascade! {
|
..append(&cascade! {
|
||||||
gtk4::Box::new(gtk4::Orientation::Vertical, 0);
|
gtk4::Box::new(gtk4::Orientation::Vertical, 0);
|
||||||
..append(&summary_label);
|
..append(&summary_label);
|
||||||
..append(&body_label);
|
..append(&body_label);
|
||||||
});
|
});
|
||||||
..append(&cascade! {
|
..append(&cascade! {
|
||||||
gtk4::Button::new();
|
gtk4::Button::new();
|
||||||
..set_valign(gtk4::Align::Start);
|
..style_context().add_provider(&cascade! {
|
||||||
..set_child(Some(&cascade! {
|
gtk4::CssProvider::new();
|
||||||
gtk4::Image::from_icon_name(Some("window-close-symbolic"));
|
..load_from_data(b"button { min-width: 0; min-height: 0; padding: 4px 4px; }");
|
||||||
}));
|
}, gtk4::STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||||
..connect_clicked(clone!(@weak obj => move |_| {
|
..style_context().add_class("flat");
|
||||||
if let Some(id) = obj.inner().id.get() {
|
..set_valign(gtk4::Align::Start);
|
||||||
obj.inner().notifications.dismiss(id);
|
..set_child(Some(&cascade! {
|
||||||
}
|
gtk4::Image::from_icon_name(Some("window-close-symbolic"));
|
||||||
}));
|
..set_pixel_size(8);
|
||||||
});
|
}));
|
||||||
|
..connect_clicked(clone!(@weak obj => move |_| {
|
||||||
|
if let Some(id) = obj.inner().id.get() {
|
||||||
|
obj.inner().notifications.dismiss(id);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.box_.set(box_);
|
self.box_.set(box_);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue