[shotwell/wip/gtk4: 110/154] Fix missing image placeholder
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/gtk4: 110/154] Fix missing image placeholder
- Date: Sat, 1 Oct 2022 17:53:17 +0000 (UTC)
commit 6643630f050366f83111348ab1a5b504695e77aa
Author: Jens Georg <mail jensge org>
Date: Wed Apr 13 21:57:09 2022 +0200
Fix missing image placeholder
src/PhotoPage.vala | 2 +-
src/camera/ImportPage.vala | 4 ++--
src/util/image.vala | 17 +++++------------
3 files changed, 8 insertions(+), 15 deletions(-)
---
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index c827d645..ea91cac0 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -1175,7 +1175,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
}
}
if (pixbuf == null) {
- //pixbuf = get_placeholder_pixbuf();
+ pixbuf = get_placeholder_pixbuf();
get_canvas_scaling().perform_on_pixbuf(pixbuf, Gdk.InterpType.NEAREST, true);
}
return pixbuf;
diff --git a/src/camera/ImportPage.vala b/src/camera/ImportPage.vala
index 724dcc45..49e3a8c0 100644
--- a/src/camera/ImportPage.vala
+++ b/src/camera/ImportPage.vala
@@ -280,16 +280,16 @@ class ImportPreview : MediaSourceItem {
} catch (Error err) {
warning("Unable to fetch loaded import preview for %s: %s", to_string(), err.message);
}
+
+ print ("======> pixbuf? %p\n", pixbuf);
// use placeholder if no preview available
bool using_placeholder = (pixbuf == null);
if (pixbuf == null) {
if (placeholder_preview == null) {
- #if 0
placeholder_preview = get_placeholder_pixbuf();
placeholder_preview = scale_pixbuf(placeholder_preview, MAX_SCALE,
Gdk.InterpType.BILINEAR, true);
- #endif
}
pixbuf = placeholder_preview;
diff --git a/src/util/image.vala b/src/util/image.vala
index 2d8e9bf1..946a5429 100644
--- a/src/util/image.vala
+++ b/src/util/image.vala
@@ -24,21 +24,14 @@ void set_source_color_from_string(Cairo.Context ctx, string spec) {
private const int MIN_SCALED_WIDTH = 10;
private const int MIN_SCALED_HEIGHT = 10;
-Gdk.Paintable get_placeholder_pixbuf () {
+Gdk.Pixbuf get_placeholder_pixbuf () {
// Create empty pixbuf.
- Gdk.Paintable? pixbuf = null;
+ Gdk.Pixbuf? pixbuf = null;
try {
- var icon_theme = Gtk.IconTheme.get_for_display (Gdk.Display.get_default());
- pixbuf = icon_theme.lookup_icon("image-missing", null,
- Gtk.IconSize.LARGE, 0, Gtk.TextDirection.NONE, 0);
- } catch (Error error) {
- try {
- pixbuf = Gdk.Texture.from_resource("/org/gnome/Shotwell/icons/image-missing.png");
- } catch (Error err) {
- warning("Could not load fall-back icon: %s", err.message);
- }
- warning("Could not load icon from theme: %s", error.message);
+ pixbuf = new Gdk.Pixbuf.from_resource("/org/gnome/Shotwell/icons/image-missing.png");
+ } catch (Error err) {
+ warning("Could not load fall-back icon: %s", err.message);
}
return pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]