image_view: Add directory navigation
This commit adds directory navigation to Image Viewer. Currently it only sorts images by name, instead of following directory sorting like the mockups.
This commit is contained in:
parent
1841789525
commit
84208d2887
7 changed files with 191 additions and 28 deletions
23
src/util.rs
Normal file
23
src/util.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
use gio::prelude::*;
|
||||
use glib::translate::*;
|
||||
|
||||
pub fn utf8_collate_key_for_filename(filename: &String) -> String {
|
||||
unsafe {
|
||||
from_glib_full(glib::ffi::g_utf8_collate_key_for_filename(
|
||||
filename.to_glib_none().0,
|
||||
filename.len() as isize,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_file_display_name(file: &gio::File) -> Option<String> {
|
||||
let info = file
|
||||
.query_info(
|
||||
*gio::FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
|
||||
gio::FileQueryInfoFlags::empty(),
|
||||
gio::NONE_CANCELLABLE,
|
||||
)
|
||||
.ok()?;
|
||||
|
||||
Some(info.display_name().to_string())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue