From 51a23728694a3f1312cc9396fc093ca178457c3c Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 22 Apr 2020 15:44:12 +0200 Subject: Add file upload preview fixes #756 --- main/src/ui/chat_input/view.vala | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'main/src/ui/chat_input/view.vala') diff --git a/main/src/ui/chat_input/view.vala b/main/src/ui/chat_input/view.vala index 166ead2e..b99cd1c4 100644 --- a/main/src/ui/chat_input/view.vala +++ b/main/src/ui/chat_input/view.vala @@ -33,17 +33,9 @@ public class View : Box { encryption_widget = new EncryptionButton(stream_interactor) { relief=ReliefStyle.NONE, margin_top=3, valign=Align.START, visible=true }; - file_button.clicked.connect(() => { - PreviewFileChooserNative chooser = new PreviewFileChooserNative("Select file", get_toplevel() as Gtk.Window, FileChooserAction.OPEN, "Select", "Cancel"); - if (chooser.run() == Gtk.ResponseType.ACCEPT) { - string uri = chooser.get_filename(); - stream_interactor.get_module(FileManager.IDENTITY).send_file.begin(uri, conversation); - } - }); file_button.get_style_context().add_class("dino-attach-button"); encryption_widget.get_style_context().add_class("dino-chatinput-button"); - encryption_widget.encryption_changed.connect(update_file_transfer_availability); // Emoji button for emoji picker (recents don't work < 3.22.19, category icons don't work <3.23.2) if (Gtk.get_major_version() >= 3 && Gtk.get_minor_version() >= 24) { @@ -68,18 +60,15 @@ public class View : Box { return this; } - private void update_file_transfer_availability() { - bool upload_available = stream_interactor.get_module(FileManager.IDENTITY).is_upload_available(conversation); - file_button.visible = upload_available; - file_separator.visible = upload_available; + public void set_file_upload_active(bool active) { + file_button.visible = active; + file_separator.visible = active; } public void initialize_for_conversation(Conversation conversation) { if (this.conversation != null) entry_cache[this.conversation] = chat_text_view.text_view.buffer.text; this.conversation = conversation; - update_file_transfer_availability(); - chat_text_view.text_view.buffer.text = ""; if (entry_cache.has_key(conversation)) { chat_text_view.text_view.buffer.text = entry_cache[conversation]; -- cgit v1.2.3-54-g00ecf