aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-02-13 01:37:11 +0100
committerfiaxh <git@lightrise.org>2019-02-13 01:43:32 +0100
commit6613f3f05a548bb3b91d03becbaa694379ecdde4 (patch)
tree044b668b076e209fd519a98a7b5e89185c54d544 /main/src
parent4a8d628924bcf9fd4af2f39ca8477b33a9599196 (diff)
downloaddino-6613f3f05a548bb3b91d03becbaa694379ecdde4.tar.gz
dino-6613f3f05a548bb3b91d03becbaa694379ecdde4.zip
Respect EXIF orientation tag
fixes #522
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_summary/content_item_widget_factory.vala16
1 files changed, 12 insertions, 4 deletions
diff --git a/main/src/ui/conversation_summary/content_item_widget_factory.vala b/main/src/ui/conversation_summary/content_item_widget_factory.vala
index 4a625cc5..0bd763ec 100644
--- a/main/src/ui/conversation_summary/content_item_widget_factory.vala
+++ b/main/src/ui/conversation_summary/content_item_widget_factory.vala
@@ -107,11 +107,17 @@ public class FileItemWidgetGenerator : WidgetGenerator, Object {
public Object get_widget(ContentItem item) {
FileItem file_item = item as FileItem;
FileTransfer transfer = file_item.file_transfer;
- if (transfer.mime_type != null && transfer.mime_type.has_prefix("image")) {
- return getImageWidget(transfer);
- } else {
- return getDefaultWidget(transfer);
+
+ if (transfer.mime_type != null) {
+ foreach (PixbufFormat pixbuf_format in Pixbuf.get_formats()) {
+ foreach (string mime_type in pixbuf_format.get_mime_types()) {
+ if (mime_type == transfer.mime_type)
+ return getImageWidget(transfer);
+ }
+ }
}
+
+ return getDefaultWidget(transfer);
}
private Widget getImageWidget(FileTransfer file_transfer) {
@@ -123,6 +129,8 @@ public class FileItemWidgetGenerator : WidgetGenerator, Object {
return null;
}
+ pixbuf = pixbuf.apply_embedded_orientation();
+
int max_scaled_height = MAX_HEIGHT * image.scale_factor;
if (pixbuf.height > max_scaled_height) {
pixbuf = pixbuf.scale_simple((int) ((double) max_scaled_height / pixbuf.height * pixbuf.width), max_scaled_height, Gdk.InterpType.BILINEAR);