[shotwell/wip/faster-import: 2/5] Attach a role to PhotoFileReader
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [shotwell/wip/faster-import: 2/5] Attach a role to PhotoFileReader
- Date: Thu, 27 Oct 2016 09:24:17 +0000 (UTC)
commit 3c3259e996d72e9d1b578b812543cdceae697edf
Author: Jens Georg <mail jensge org>
Date: Sun Oct 9 18:24:41 2016 +0200
Attach a role to PhotoFileReader
Signed-off-by: Jens Georg <mail jensge org>
src/Photo.vala | 1 +
src/photos/PhotoFileAdapter.vala | 15 +++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
---
diff --git a/src/Photo.vala b/src/Photo.vala
index 11dbae6..6b7c449 100644
--- a/src/Photo.vala
+++ b/src/Photo.vala
@@ -1258,6 +1258,7 @@ public abstract class Photo : PhotoSource, Dateable {
if (params.thumbnails != null) {
PhotoFileReader reader = params.row.master.file_format.create_reader(
params.row.master.filepath);
+ reader.set_role (PhotoFileReader.Role.THUMBNAIL);
try {
ThumbnailCache.generate_for_photo(params.thumbnails, reader, params.row.orientation,
params.row.master.dim);
diff --git a/src/photos/PhotoFileAdapter.vala b/src/photos/PhotoFileAdapter.vala
index 644917c..df49edb 100644
--- a/src/photos/PhotoFileAdapter.vala
+++ b/src/photos/PhotoFileAdapter.vala
@@ -57,6 +57,13 @@ public abstract class PhotoFileAdapter {
//
public abstract class PhotoFileReader : PhotoFileAdapter {
+ public enum Role {
+ DEFAULT,
+ THUMBNAIL
+ }
+
+ PhotoFileReader.Role role = Role.DEFAULT;
+
protected PhotoFileReader(string filepath, PhotoFileFormat file_format) {
base (filepath, file_format);
}
@@ -76,6 +83,14 @@ public abstract class PhotoFileReader : PhotoFileAdapter {
public virtual Gdk.Pixbuf scaled_read(Dimensions full, Dimensions scaled) throws Error {
return resize_pixbuf(unscaled_read(), scaled, Gdk.InterpType.BILINEAR);
}
+
+ public void set_role (PhotoFileReader.Role role) {
+ this.role = role;
+ }
+
+ public PhotoFileReader.Role get_role () {
+ return this.role;
+ }
}
//
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]