[polari] urlPreview: Show fallback image on failure
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [polari] urlPreview: Show fallback image on failure
- Date: Wed, 5 Aug 2020 13:47:09 +0000 (UTC)
commit 05c8269c6fb09e4f5b9ba18ca77774d833034145
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 30 00:45:38 2020 +0200
urlPreview: Show fallback image on failure
We should only show the loading indicator when we are actually
loading the image, not when the operation completed but failed.
Switch to an appropriate fallback in that case.
https://gitlab.gnome.org/GNOME/polari/-/issues/149
src/urlPreview.js | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/urlPreview.js b/src/urlPreview.js
index 88cf9d2e..5ff426f6 100644
--- a/src/urlPreview.js
+++ b/src/urlPreview.js
@@ -103,9 +103,9 @@ var URLPreview = GObject.registerClass({
this._imageLoaded = false;
this._image = new Gtk.Image({
- icon_name: 'image-loading-symbolic',
visible: true,
});
+ this._image.get_style_context().add_class('dim-label');
this.add(this._image);
this._label = new Gtk.Label({
@@ -122,6 +122,10 @@ var URLPreview = GObject.registerClass({
return;
this._imageLoaded = true;
+ this._image.set({
+ icon_name: 'image-loading-symbolic',
+ pixel_size: 16,
+ });
const thumbnailer = Thumbnailer.getDefault();
try {
@@ -129,6 +133,10 @@ var URLPreview = GObject.registerClass({
this._image.set_from_file(filename);
} catch (e) {
log(`Thumbnail generation for ${this.uri} failed: ${e}`);
+ this._image.set({
+ icon_name: 'image-x-generic-symbolic',
+ pixel_size: 64,
+ });
}
let title = null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]