aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui')
-rw-r--r--main/src/ui/conversation_view_controller.vala19
-rw-r--r--main/src/ui/file_send_overlay.vala6
2 files changed, 18 insertions, 7 deletions
diff --git a/main/src/ui/conversation_view_controller.vala b/main/src/ui/conversation_view_controller.vala
index d830fc9e..831aae73 100644
--- a/main/src/ui/conversation_view_controller.vala
+++ b/main/src/ui/conversation_view_controller.vala
@@ -140,7 +140,7 @@ public class ConversationViewController : Object {
private void update_file_upload_status() {
bool upload_available = stream_interactor.get_module(FileManager.IDENTITY).is_upload_available(conversation);
chat_input_controller.set_file_upload_active(upload_available);
- if (upload_available) {
+ if (upload_available && overlay_dialog == null) {
Gtk.drag_dest_set(view, DestDefaults.ALL, target_list, Gdk.DragAction.COPY);
} else {
Gtk.drag_dest_unset(view);
@@ -184,11 +184,10 @@ public class ConversationViewController : Object {
switch (target_type) {
case Target.URI_LIST:
string[] uris = selection_data.get_uris();
- for (int i = 0; i < uris.length; i++) {
- try {
- string file_path = Filename.from_uri(uris[i]);
- open_send_file_overlay(File.new_for_path(file_path));
- } catch (Error err) {}
+ // For now we only process the first dragged file
+ if (uris.length >= 1) {
+ string file_path = Filename.from_uri(uris[0]);
+ open_send_file_overlay(File.new_for_path(file_path));
}
break;
default:
@@ -226,8 +225,16 @@ public class ConversationViewController : Object {
}
}
+ overlay.close.connect(() => {
+ // We don't want drag'n'drop to be active while the overlay is active
+ overlay_dialog = null;
+ update_file_upload_status();
+ });
+
view.add_overlay_dialog(overlay);
overlay_dialog = overlay;
+
+ update_file_upload_status();
}
private void send_file(File file) {
diff --git a/main/src/ui/file_send_overlay.vala b/main/src/ui/file_send_overlay.vala
index c19a5aef..feb18e8c 100644
--- a/main/src/ui/file_send_overlay.vala
+++ b/main/src/ui/file_send_overlay.vala
@@ -20,9 +20,13 @@ public class FileSendOverlay : Gtk.EventBox {
private bool can_send = true;
public FileSendOverlay(File file, FileInfo file_info) {
- close_button.clicked.connect(() => this.destroy());
+ close_button.clicked.connect(() => {
+ this.close();
+ this.destroy();
+ });
send_button.clicked.connect(() => {
send_file();
+ this.close();
this.destroy();
});