imagePage: Show specific error for out of memory

Part-of: <https://gitlab.gnome.org/GNOME/loupe/-/merge_requests/435>
This commit is contained in:
Sophie Herold 2024-07-26 22:54:24 +02:00 • committed by Marge Bot
parent 9bd68cd8dd
commit b33943fbe2
3 changed files with 16 additions and 5 deletions

View file

@ -261,9 +261,15 @@ impl LpImagePage {
}
));
imp.error_page.set_description(Some(&gettext(
"Either the image file is corrupted or it contains unsupported elements.",
)));
if image.specific_error() == DecoderError::OutOfMemory {
imp.error_page.set_description(Some(&gettext(
"There is not enough free memory available to load this image.",
)));
} else {
imp.error_page.set_description(Some(&gettext(
"Either the image file is corrupted or it contains unsupported elements.",
)));
}
imp.error_more_info.set_visible(true);
imp.stack.set_visible_child(&*imp.error_page);