file_model: Add file() function
Adds a function to get the file at a given index directly, instead of going through GListModel::item().
This commit is contained in:
parent
e13ecb4df4
commit
70054971d9
2 changed files with 9 additions and 11 deletions
|
|
@ -119,6 +119,11 @@ impl LpFileModel {
|
|||
self.imp().directory.get().cloned()
|
||||
}
|
||||
|
||||
pub fn file(&self, index: u32) -> Option<gio::File> {
|
||||
let vec = self.imp().inner.borrow();
|
||||
vec.get(index as usize).cloned()
|
||||
}
|
||||
|
||||
pub fn index_of(&self, file: &gio::File) -> Option<usize> {
|
||||
let imp = self.imp();
|
||||
let vec = imp.inner.borrow();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue