imageView: Add only viewed images to recently used
Only adding images expclicitly opened via file browser or drag and drop. Do not add images while browsing SlidingView to avoid spamming recently used files. Closes #53
This commit is contained in:
parent
05ef429b86
commit
6a4ee11c76
2 changed files with 4 additions and 4 deletions
|
|
@ -153,10 +153,6 @@ impl LpImagePage {
|
|||
|
||||
obj.imp().image.set_file(&file);
|
||||
|
||||
// This doesn't work properly for items not explicitly selected
|
||||
// via the file chooser portal. I'm not sure how to make this work.
|
||||
gtk::RecentManager::default().add_item(&file.uri());
|
||||
|
||||
spawn!(clone!(@weak obj, @strong path => async move {
|
||||
let imp = obj.imp();
|
||||
imp.image.load(&path).await;
|
||||
|
|
|
|||
|
|
@ -245,6 +245,10 @@ glib::wrapper! {
|
|||
#[gtk::template_callbacks]
|
||||
impl LpImageView {
|
||||
pub fn set_image_from_path(&self, path: &Path) {
|
||||
// Add image to recently used file. Does not work in Flatpaks:
|
||||
// <https://github.com/flatpak/xdg-desktop-portal/issues/215>
|
||||
gtk::RecentManager::default().add_item(&dbg!(gio::File::for_path(path).uri()));
|
||||
|
||||
if let Err(err) = self.load_path(path) {
|
||||
log::error!("Failed to load path: {err}");
|
||||
self.activate_action("win.show-toast", Some(&(err.to_string(), 1).to_variant()))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue