1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-12 15:31:03 +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,4 +1,5 @@
use crate::config::CommonConfig;
use crate::gtk_helpers::add_class;
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::popup::Popup;
use crate::{send_async, try_send};
@ -96,20 +97,16 @@ impl Module<Button> for ClockModule {
rx: glib::Receiver<Self::SendMessage>,
_info: &ModuleInfo,
) -> Option<gtk::Box> {
let container = gtk::Box::builder()
.orientation(Orientation::Vertical)
.name("popup-clock")
.build();
let container = gtk::Box::new(Orientation::Vertical, 0);
let clock = Label::builder()
.name("calendar-clock")
.halign(Align::Center)
.build();
let clock = Label::builder().halign(Align::Center).build();
add_class(&clock, "calendar-clock");
let format = "%H:%M:%S";
container.add(&clock);
let calendar = Calendar::builder().name("calendar").build();
let calendar = Calendar::new();
add_class(&calendar, "calendar");
container.add(&calendar);
{