1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-08-17 14:51:04 +02:00

feat: module-level name and class options

BREAKING CHANGE: To allow for the `name` property, any widgets that were previously targeted by name should be targeted by class instead. This affects **all modules and all popups**, as well as several widgets inside modules. **This will break a lot of rules in your stylesheet**. To attempt to mitigate the damage, a migration script can be found [here](https://raw.githubusercontent.com/JakeStanger/ironbar/master/scripts/migrate-styles.sh) that should get you most of the way.

Resolves #75.
This commit is contained in:
Jake Stanger 2023-05-06 00:40:06 +01:00
parent 528a8d6dd6
commit dea66415c2
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
30 changed files with 352 additions and 215 deletions

View file

@ -1,5 +1,6 @@
use crate::clients::upower::get_display_proxy;
use crate::config::CommonConfig;
use crate::gtk_helpers::add_class;
use crate::image::ImageProvider;
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::popup::Popup;
@ -144,20 +145,20 @@ impl Module<gtk::Box> for UpowerModule {
info: &ModuleInfo,
) -> Result<ModuleWidget<gtk::Box>> {
let icon_theme = info.icon_theme.clone();
let icon = gtk::Image::builder().name("icon").build();
let icon = gtk::Image::new();
add_class(&icon, "icon");
let label = Label::builder()
.label(&self.format)
.use_markup(true)
.name("label")
.build();
add_class(&label, "label");
let container = gtk::Box::builder()
.orientation(Orientation::Horizontal)
.name("upower")
.build();
let container = gtk::Box::new(Orientation::Horizontal, 0);
add_class(&container, "upower");
let button = Button::builder().name("button").build();
let button = Button::new();
add_class(&button, "button");
button.add(&label);
container.add(&button);
@ -207,11 +208,10 @@ impl Module<gtk::Box> for UpowerModule {
{
let container = gtk::Box::builder()
.orientation(Orientation::Horizontal)
.name("popup-upower")
.build();
let label = Label::builder().name("upower-details").build();
container.add(&label);
let label = Label::new(None);
add_class(&label, "upower-details");
rx.attach(None, move |properties| {
let mut format = String::new();