From f6db249c92e8fd25c1cb52872d3a647be034b626 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sun, 28 Jan 2018 20:56:27 +0100 Subject: Only display transferred images, display file names, open in system viewer, include and use pgp embedded file names --- .../ui/conversation_summary/default_file_display.vala | 4 ++-- main/src/ui/conversation_summary/image_display.vala | 17 ++++------------- 2 files changed, 6 insertions(+), 15 deletions(-) (limited to 'main/src/ui/conversation_summary') diff --git a/main/src/ui/conversation_summary/default_file_display.vala b/main/src/ui/conversation_summary/default_file_display.vala index 15eab6fe..1547440b 100644 --- a/main/src/ui/conversation_summary/default_file_display.vala +++ b/main/src/ui/conversation_summary/default_file_display.vala @@ -66,9 +66,9 @@ public class DefaultFileDisplay : Plugins.MetaConversationItem { event_box.button_release_event.connect((event_button) => { if (event_button.button == 1) { try{ - AppInfo.launch_default_for_uri("file://" + file_transfer.get_uri(), null); + AppInfo.launch_default_for_uri(file_transfer.get_file().get_uri(), null); } catch (Error err) { - print("Tried to open " + file_transfer.get_uri()); + print("Tried to open " + file_transfer.get_file().get_path()); } } return false; diff --git a/main/src/ui/conversation_summary/image_display.vala b/main/src/ui/conversation_summary/image_display.vala index c1cd32a1..15880836 100644 --- a/main/src/ui/conversation_summary/image_display.vala +++ b/main/src/ui/conversation_summary/image_display.vala @@ -41,7 +41,7 @@ public class ImageDisplay : Plugins.MetaConversationItem { Image image = new Image() { halign=Align.START, visible = true }; Gdk.Pixbuf pixbuf; try { - pixbuf = new Gdk.Pixbuf.from_file(file_transfer.get_uri()); + pixbuf = new Gdk.Pixbuf.from_file(file_transfer.get_file().get_path()); } catch (Error error) { return null; } @@ -65,16 +65,7 @@ public class ImageDisplay : Plugins.MetaConversationItem { Label url_label = builder.get_object("url_label") as Label; Util.force_color(url_label, "#eee"); - file_transfer.notify["info"].connect_after(() => { update_info(url_label, file_transfer.info); }); - update_info(url_label, file_transfer.info); - - Image copy_image = builder.get_object("copy_image") as Image; - Util.force_css(copy_image, "*:not(:hover) { color: #eee; }"); - Button copy_button = builder.get_object("copy_button") as Button; - Util.force_css(copy_button, "*:hover { background-color: rgba(255,255,255,0.3); border-color: transparent; }"); - copy_button.clicked.connect(() => { - if (file_transfer.info != null) Clipboard.get_default(Gdk.Display.get_default()).set_text(file_transfer.info, file_transfer.info.length); - }); + update_info(url_label, file_transfer.file_name); Image open_image = builder.get_object("open_image") as Image; Util.force_css(open_image, "*:not(:hover) { color: #eee; }"); @@ -82,9 +73,9 @@ public class ImageDisplay : Plugins.MetaConversationItem { Util.force_css(open_button, "*:hover { background-color: rgba(255,255,255,0.3); border-color: transparent; }"); open_button.clicked.connect(() => { try{ - AppInfo.launch_default_for_uri(file_transfer.info, null); + AppInfo.launch_default_for_uri(file_transfer.get_file().get_uri(), null); } catch (Error err) { - print("Tried to open " + file_transfer.info); + print("Tried to open file://" + file_transfer.get_file().get_path() + " " + err.message + "\n"); } }); -- cgit v1.2.3-70-g09d2