Skip to content

Commit

Permalink
fix: Don't hard-code my home directory
Browse files Browse the repository at this point in the history
  • Loading branch information
blissd committed Mar 26, 2024
1 parent 84d60d8 commit a87f788
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/all_photos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ impl RelmGridItem for PicturePreview {
.set_filename(self.picture.square_preview_path.clone());
}

fn unbind(&mut self, widgets: &mut Self::Widgets, root: &mut Self::Root) {
fn unbind(&mut self, widgets: &mut Self::Widgets, _root: &mut Self::Root) {
widgets.picture.set_filename(None::<&path::Path>);
}
}
Expand All @@ -77,6 +77,7 @@ impl SimpleComponent for AllPhotos {
set_margin_all: 0,

gtk::ScrolledWindow {

//set_propagate_natural_height: true,
//set_has_frame: true,
set_vexpand: true,
Expand Down
5 changes: 4 additions & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ impl SimpleComponent for App {
let cache_dir = glib::user_cache_dir().join("photo-romantic");
let _ = std::fs::create_dir_all(&cache_dir);

let pic_base_dir = path::Path::new("/var/home/david/Pictures");
// TODO use XDG_PICTURES_DIR as the default, but let users override in preferences.
let pic_base_dir = glib::user_special_dir(glib::enums::UserDirectory::Pictures)
.expect("Expect XDG_PICTURES_DIR");

let repo = {
let db_path = data_dir.join("pictures.sqlite");
photos_core::Repository::open(&pic_base_dir, &db_path).unwrap()
Expand Down

0 comments on commit a87f788

Please sign in to comment.