Skip to content

Commit

Permalink
Disable Selfies view
Browse files Browse the repository at this point in the history
  • Loading branch information
blissd committed Apr 8, 2024
1 parent 1dd954b commit 3ab1a24
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
5 changes: 5 additions & 0 deletions data/dev.romantics.Photos.gschema.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@
<default>false</default>
<summary>Window maximized state</summary>
</key>
<key name="show-selfies" type="b">
<!-- Disabled for now as it only works for iPhone selfies -->
<default>false</default>
<summary>Show selfies view</summary>
</key>
</schema>
</schemalist>
13 changes: 13 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ pub(super) struct App {
month_photos: AsyncController<MonthPhotos>,
year_photos: AsyncController<YearPhotos>,
one_photo: Controller<OnePhoto>,

show_selfies: bool,
selfie_photos: AsyncController<Album>,

// Grid of folders of photos
Expand Down Expand Up @@ -335,6 +337,7 @@ impl SimpleComponent for App {
set_orientation: gtk::Orientation::Vertical,
container_add: model.selfie_photos.widget(),
} -> {
set_visible: model.show_selfies,
set_title: "Selfies",
set_name: "Selfies",
// NOTE gtk::StackSidebar doesn't show icon :-/
Expand Down Expand Up @@ -470,6 +473,8 @@ impl SimpleComponent for App {
AlbumOutput::PhotoSelected(id) => AppMsg::ViewPhoto(id),
});

let show_selfies = AppWidgets::show_selfies();

let folder_photos = FolderPhotos::builder()
.launch(repo.clone())
.forward(sender.input_sender(), |msg| match msg {
Expand Down Expand Up @@ -522,6 +527,7 @@ impl SimpleComponent for App {
year_photos,
one_photo,
selfie_photos,
show_selfies,
folder_photos,
folder_album,
main_navigation: main_navigation.clone(),
Expand Down Expand Up @@ -748,6 +754,13 @@ impl SimpleComponent for App {
}

impl AppWidgets {

fn show_selfies() -> bool {
let settings = gio::Settings::new(APP_ID);
let show_selfies = settings.boolean("show-selfies");
show_selfies
}

fn save_window_size(&self) -> Result<(), glib::BoolError> {
let settings = gio::Settings::new(APP_ID);
let (width, height) = self.main_window.default_size();
Expand Down

0 comments on commit 3ab1a24

Please sign in to comment.