window,image_view: Move fullscreen controls to the image view
Allan Day's latest mockups have the fullscreen icon on the bottom left of the image. This commit moves the icon there, using a GtkExpression for the icon name.
This commit is contained in:
parent
689f975bf0
commit
9ba6cced6c
4 changed files with 32 additions and 21 deletions
|
|
@ -349,6 +349,15 @@ impl LpImageView {
|
|||
}
|
||||
}
|
||||
|
||||
#[template_callback]
|
||||
fn get_fullscreen_icon(&self, fullscreened: bool) -> &'static str {
|
||||
if fullscreened {
|
||||
"view-restore-symbolic"
|
||||
} else {
|
||||
"view-fullscreen-symbolic"
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_wallpaper(&self) -> anyhow::Result<()> {
|
||||
let wallpaper = self.uri().context("No URI for current file")?;
|
||||
let ctx = glib::MainContext::default();
|
||||
|
|
|
|||
|
|
@ -62,8 +62,6 @@ mod imp {
|
|||
#[template_child]
|
||||
pub menu_button: TemplateChild<gtk::MenuButton>,
|
||||
#[template_child]
|
||||
pub fullscreen_button: TemplateChild<gtk::Button>,
|
||||
#[template_child]
|
||||
pub toast_overlay: TemplateChild<adw::ToastOverlay>,
|
||||
#[template_child]
|
||||
pub stack: TemplateChild<gtk::Stack>,
|
||||
|
|
@ -219,20 +217,9 @@ impl LpWindow {
|
|||
if fullscreen {
|
||||
imp.flap.set_fold_policy(adw::FlapFoldPolicy::Always);
|
||||
imp.headerbar.add_css_class("osd");
|
||||
imp.menu_button.unparent();
|
||||
imp.fullscreen_button.unparent();
|
||||
imp.headerbar.pack_end(&*imp.fullscreen_button);
|
||||
imp.headerbar.pack_end(&*imp.menu_button);
|
||||
imp.fullscreen_button.set_icon_name("view-restore-symbolic");
|
||||
} else {
|
||||
imp.flap.set_fold_policy(adw::FlapFoldPolicy::Never);
|
||||
imp.headerbar.remove_css_class("osd");
|
||||
imp.menu_button.unparent();
|
||||
imp.fullscreen_button.unparent();
|
||||
imp.headerbar.pack_end(&*imp.menu_button);
|
||||
imp.headerbar.pack_end(&*imp.fullscreen_button);
|
||||
imp.fullscreen_button
|
||||
.set_icon_name("view-fullscreen-symbolic");
|
||||
}
|
||||
|
||||
self.set_fullscreened(fullscreen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue