Skip to content

Commit 790072c

Browse files
committed
Remove redundant drag and drop logic code.
1 parent 500472c commit 790072c

File tree

2 files changed

+1
-29
lines changed

2 files changed

+1
-29
lines changed

src/main.rs

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -506,26 +506,13 @@ async fn main() -> Result<(), BoxError> {
506506
win.iconize();
507507
});
508508

509-
let remote_nodes_clone = remote_nodes.clone();
510509
let mut table_clone = table.clone();
511-
let mut w = win.clone();
510+
let w = win.clone();
512511
win.handle(move |_, ev| {
513512
if ev == Event::Resize {
514513
let h = w.height() - MENUBAR_HEIGHT - LOG_HEIGHT;
515514
content_table::update_table_size(&mut table_clone, w.width(), h);
516515
true // Indicate that the event was handled
517-
} else if ev == Event::DndEnter || ev == Event::DndDrag || ev == Event::DndRelease {
518-
true
519-
} else if ev == Event::Paste {
520-
let new_configs = paste_operations::files_drag_n_drop();
521-
if new_configs.is_empty() {
522-
return false; // No new configs to add
523-
}
524-
for config in new_configs {
525-
remote_nodes_clone.borrow_mut().push(config);
526-
}
527-
refresh_table(&mut table_clone, &mut w, remote_nodes_clone.borrow().len());
528-
true
529516
} else {
530517
false
531518
}

src/paste_operations.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,6 @@ pub fn paste() -> std::io::Result<OverTlsNode> {
2525
config_from_image(&dyn_img)
2626
}
2727

28-
pub fn files_drag_n_drop() -> Vec<OverTlsNode> {
29-
let mut configs = Vec::new();
30-
for line in fltk::app::event_text().lines() {
31-
let path = line.trim();
32-
if path.is_empty() {
33-
continue;
34-
}
35-
match process_inputed_file(path) {
36-
Ok(config) => configs.push(config),
37-
Err(e) => log::warn!("Failed to process dropped file: {e}"),
38-
}
39-
}
40-
configs
41-
}
42-
4328
pub fn process_inputed_file<P: AsRef<std::path::Path>>(path: P) -> std::io::Result<OverTlsNode> {
4429
use std::io::{Error, ErrorKind::InvalidData};
4530
let path = path.as_ref();

0 commit comments

Comments
 (0)