Add fullscreen button

This commit is contained in:
Julian Mutter 2024-11-27 15:53:54 +01:00
parent 4053fa70f4
commit ac261f0761

View File

@ -216,6 +216,7 @@ impl Ui {
pub fn build(app: &Application) -> Rc<RefCell<Ui>> {
debug!("building ui");
let open_file_button = Button::from_icon_name("document-open");
let fullscreen_button = Button::from_icon_name("view-fullscreen");
let normal_color_mode_button = ToggleButton::builder().label("Std").active(true).build();
let dark_color_mode_button = ToggleButton::builder()
.label("Dark")
@ -227,7 +228,7 @@ impl Ui {
.build();
let button_container = Box::builder()
.spacing(5)
.spacing(10)
.hexpand(true)
.orientation(gtk::Orientation::Horizontal)
.build();
@ -240,6 +241,7 @@ impl Ui {
color_mode_button_container.append(&dark_color_mode_button);
color_mode_button_container.append(&sepia_color_mode_button);
button_container.append(&open_file_button);
button_container.append(&fullscreen_button);
button_container.append(&color_mode_button_container);
let image_container = Box::builder()
@ -327,6 +329,11 @@ impl Ui {
choose_file(Rc::clone(&ui), &ui.borrow().window);
}),
);
fullscreen_button.connect_clicked(
glib::clone!(@strong ui => @default-panic, move |_button| {
toggle_fullscreen(&ui.borrow());
}),
);
normal_color_mode_button.connect_clicked(
glib::clone!(@strong ui => @default-panic, move |_button| {
switch_color_mode(Rc::clone(&ui), ColorMode::Normal);