parent
403aa7771c
commit
127986a8ea
1 changed files with 12 additions and 7 deletions
|
|
@ -31,7 +31,7 @@ use std::path::{Path, PathBuf};
|
||||||
use adw::prelude::*;
|
use adw::prelude::*;
|
||||||
use adw::subclass::prelude::*;
|
use adw::subclass::prelude::*;
|
||||||
use glib::clone;
|
use glib::clone;
|
||||||
use gtk::CompositeTemplate;
|
use gtk::{CompositeTemplate, Widget};
|
||||||
|
|
||||||
use crate::application::LpApplication;
|
use crate::application::LpApplication;
|
||||||
use crate::config;
|
use crate::config;
|
||||||
|
|
@ -742,9 +742,11 @@ impl LpWindow {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles change in availability of images
|
/// Handles change in image and availability of images
|
||||||
fn on_current_page_changed(&self) {
|
fn on_current_page_changed(&self) {
|
||||||
let imp = self.imp();
|
let imp = self.imp();
|
||||||
|
let was_showing_image =
|
||||||
|
imp.stack.visible_child().as_ref() == Some(imp.image_view.upcast_ref::<Widget>());
|
||||||
let current_page = imp.image_view.current_page();
|
let current_page = imp.image_view.current_page();
|
||||||
|
|
||||||
// HeaderBar style
|
// HeaderBar style
|
||||||
|
|
@ -768,16 +770,19 @@ impl LpWindow {
|
||||||
);
|
);
|
||||||
|
|
||||||
if has_image {
|
if has_image {
|
||||||
// Properties buttons was not enabled before. Pickup config state for enabling
|
// Properties buttons was not sensitive before
|
||||||
// it again.
|
|
||||||
if !imp.properties_button.is_sensitive() {
|
if !imp.properties_button.is_sensitive() {
|
||||||
let settings = LpApplication::default().settings();
|
let settings = LpApplication::default().settings();
|
||||||
|
// Pickup config for setting it's state
|
||||||
imp.properties_button
|
imp.properties_button
|
||||||
.set_active(settings.boolean("show-properties"));
|
.set_active(settings.boolean("show-properties"));
|
||||||
}
|
}
|
||||||
imp.stack.set_visible_child(&*imp.image_view);
|
if !was_showing_image {
|
||||||
imp.image_view.grab_focus();
|
imp.stack.set_visible_child(&*imp.image_view);
|
||||||
self.schedule_hide_controls();
|
imp.image_view.grab_focus();
|
||||||
|
self.show_controls();
|
||||||
|
self.schedule_hide_controls();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
imp.properties_button.set_active(false);
|
imp.properties_button.set_active(false);
|
||||||
imp.stack.set_visible_child(&*imp.status_page);
|
imp.stack.set_visible_child(&*imp.status_page);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue