1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-03 19:51:03 +02:00

fix: poor error handling for missing images

Previously images that could not be located were handled by throwing a
full report error, which incorrectly stated it was an invalid image
*type*.

This changes the image handling to instead log a single-line warning
directly in the image provider code, reducing the error handling
required by each consumer.

Resolves #146.
This commit is contained in:
Jake Stanger 2023-05-20 14:36:04 +01:00
parent 960da55a05
commit 87ca399220
7 changed files with 52 additions and 62 deletions

View file

@ -192,16 +192,13 @@ impl ItemButton {
let gtk_image = gtk::Image::new();
let image =
ImageProvider::parse(&item.app_id.clone(), icon_theme, appearance.icon_size);
match image {
Ok(image) => {
button.set_image(Some(&gtk_image));
button.set_always_show_image(true);
if let Some(image) = image {
button.set_image(Some(&gtk_image));
button.set_always_show_image(true);
if let Err(err) = image.load_into_image(gtk_image) {
error!("{err:?}");
}
if let Err(err) = image.load_into_image(gtk_image) {
error!("{err:?}");
}
Err(err) => error!("{err:?}"),
};
}