From e11177fea3095560057278d71cebca01bed295d6 Mon Sep 17 00:00:00 2001 From: Jake Stanger Date: Mon, 12 Jun 2023 22:24:51 +0100 Subject: [PATCH] fix: add sensible class names for icon labels BREAKING CHANGE: Where both textual and image icons are supported, CSS classes have changed to better reflect their targets. `.icon` has changed to `.icon-box` and `.icon` now targets the underlying element. `.label` has been changed to `.icon.text-icon`. This affects icons on the **music**, **workspaces**, and **clipboard** modules. Resolves #185. --- src/image/gtk.rs | 5 ++++- src/modules/music/mod.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/image/gtk.rs b/src/image/gtk.rs index 68e8c54..79b0da2 100644 --- a/src/image/gtk.rs +++ b/src/image/gtk.rs @@ -10,6 +10,7 @@ pub fn new_icon_button(input: &str, icon_theme: &IconTheme, size: i32) -> Button if ImageProvider::is_definitely_image_input(input) { let image = Image::new(); add_class(&image, "image"); + add_class(&image, "icon"); match ImageProvider::parse(input, icon_theme, size) .map(|provider| provider.load_into_image(image.clone())) @@ -35,6 +36,7 @@ pub fn new_icon_label(input: &str, icon_theme: &IconTheme, size: i32) -> gtk::Bo if ImageProvider::is_definitely_image_input(input) { let image = Image::new(); + add_class(&image, "icon"); add_class(&image, "image"); container.add(&image); @@ -43,7 +45,8 @@ pub fn new_icon_label(input: &str, icon_theme: &IconTheme, size: i32) -> gtk::Bo .map(|provider| provider.load_into_image(image)); } else { let label = Label::new(Some(input)); - add_class(&label, "label"); + add_class(&label, "icon"); + add_class(&label, "text-icon"); container.add(&label); } diff --git a/src/modules/music/mod.rs b/src/modules/music/mod.rs index 28595fc..1fda33e 100644 --- a/src/modules/music/mod.rs +++ b/src/modules/music/mod.rs @@ -454,7 +454,7 @@ impl IconLabel { let icon = new_icon_label(icon_input, icon_theme, 24); let label = Label::new(label); - add_class(&icon, "icon"); + add_class(&icon, "icon-box"); add_class(&label, "label"); container.add(&icon);