Commit 657c5d51 authored by Eisha Chen-yen-su's avatar Eisha Chen-yen-su

MediaViewer: Implement the full screen mode

See https://gitlab.gnome.org/World/fractal/issues/13
parent 77943c00
......@@ -30,6 +30,14 @@ impl App {
op.lock().unwrap().zoom_in();
});
let op = self.op.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 op = self.op.clone();
let back_btn = self.ui.builder
.get_object::<gtk::Button>("media_viewer_back_button")
......
extern crate gdk;
extern crate gtk;
use self::gtk::prelude::*;
use glib;
use uibuilder;
use app::App;
use appop::AppOp;
use appop::AppState;
......@@ -259,6 +263,28 @@ impl AppOp {
}
}
}
pub fn enter_full_screen(&self) {
let main_window = self.ui.builder
.get_object::<gtk::ApplicationWindow>("main_window")
.expect("Cant find main_window in ui file.");
main_window.fullscreen();
main_window.connect_key_release_event(move |_, k| {
if k.get_keyval() == gdk::enums::key::Escape {
APPOP!(leave_full_screen);
}
Inhibit(false)
});
}
pub fn leave_full_screen(&self) {
let main_window = self.ui.builder
.get_object::<gtk::ApplicationWindow>("main_window")
.expect("Cant find main_window in ui file.");
main_window.unfullscreen();
}
}
fn update_zoom_entry(ui: &uibuilder::UI, zoom_level: f64) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment