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.
This commit is contained in:
Jake Stanger 2023-06-12 22:24:51 +01:00
parent cbba2bc614
commit e11177fea3
No known key found for this signature in database
GPG Key ID: C51FC8F9CB0BEA61
2 changed files with 5 additions and 2 deletions

View File

@ -10,6 +10,7 @@ pub fn new_icon_button(input: &str, icon_theme: &IconTheme, size: i32) -> Button
if ImageProvider::is_definitely_image_input(input) { if ImageProvider::is_definitely_image_input(input) {
let image = Image::new(); let image = Image::new();
add_class(&image, "image"); add_class(&image, "image");
add_class(&image, "icon");
match ImageProvider::parse(input, icon_theme, size) match ImageProvider::parse(input, icon_theme, size)
.map(|provider| provider.load_into_image(image.clone())) .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) { if ImageProvider::is_definitely_image_input(input) {
let image = Image::new(); let image = Image::new();
add_class(&image, "icon");
add_class(&image, "image"); add_class(&image, "image");
container.add(&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)); .map(|provider| provider.load_into_image(image));
} else { } else {
let label = Label::new(Some(input)); let label = Label::new(Some(input));
add_class(&label, "label"); add_class(&label, "icon");
add_class(&label, "text-icon");
container.add(&label); container.add(&label);
} }

View File

@ -454,7 +454,7 @@ impl IconLabel {
let icon = new_icon_label(icon_input, icon_theme, 24); let icon = new_icon_label(icon_input, icon_theme, 24);
let label = Label::new(label); let label = Label::new(label);
add_class(&icon, "icon"); add_class(&icon, "icon-box");
add_class(&label, "label"); add_class(&label, "label");
container.add(&icon); container.add(&icon);