MediaViewer: Modify a button to leave full screen

This modifies the full screen button so that it enables the user to
leave the full screen mode when already in full screen.

See https://gitlab.gnome.org/World/fractal/issues/265
This commit is contained in:
Eisha CHEN-YEN-SU 2018-06-30 15:12:10 +02:00
parent ad61ec17c9
commit 936e552236

View file

@ -39,11 +39,21 @@ impl App {
});
let op = self.op.clone();
let ui = self.ui.clone();
let full_screen_button = self.ui.builder
.get_object::<gtk::Button>("full_screen_button")
.expect("Cant find full_screen_button in ui file.");
full_screen_button.connect_clicked(move |_| {
op.lock().unwrap().enter_full_screen();
let main_window = ui.builder
.get_object::<gtk::Window>("main_window")
.expect("Cant find main_window in ui file.");
if let Some(win) = main_window.get_window() {
if !win.get_state().contains(gdk::WindowState::FULLSCREEN) {
op.lock().unwrap().enter_full_screen();
} else {
op.lock().unwrap().leave_full_screen()
}
}
});
let op = self.op.clone();