Skip to content

Commit

Permalink
Fix unordered file selection
Browse files Browse the repository at this point in the history
  • Loading branch information
nik012003 committed Jun 25, 2024
1 parent d47d933 commit ef303f8
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "ripdrag"
authors = ["Nicola Guerrera <[email protected]>"]
description = "Drag and Drop files to and from the terminal"
version = "0.4.8"
version = "0.4.9"
readme = "README.md"
repository = "https://github.com/nik012003/ripdrag"
edition = "2021"
Expand Down
7 changes: 3 additions & 4 deletions src/list_view.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::collections::HashSet;

use glib_macros::clone;
use gtk::gdk::*;
use gtk::gio::{self, ListStore};
Expand Down Expand Up @@ -60,9 +58,10 @@ fn create_drag_source(row: &CenterBox, selection: &MultiSelection) -> DragSource
// This will prevent the click to trigger, a drag should happen!
me.set_state(gtk::EventSequenceState::Claimed);
let selected = selection.selection();
let mut files : HashSet<String> = HashSet::with_capacity(selected.size() as usize);
let mut files : Vec<String> = Vec::with_capacity(selected.size() as usize);

for index in 0..selected.size() {
files.insert(selection.item(selected.nth(index as u32)).unwrap().downcast::<FileObject>().unwrap().file().uri().to_string());
files.push(selection.item(selected.nth(index as u32)).unwrap().downcast::<FileObject>().unwrap().file().uri().to_string());
}

// Is the activated row also selected?
Expand Down

0 comments on commit ef303f8

Please sign in to comment.