|
|
|
@ -1,7 +1,15 @@
@@ -1,7 +1,15 @@
|
|
|
|
|
#[path = "browser/header.rs"] mod header; |
|
|
|
|
#[path = "browser/main.rs"] mod main; |
|
|
|
|
|
|
|
|
|
use gtk::{Application, ApplicationWindow}; |
|
|
|
|
use gtk::{ |
|
|
|
|
Application, |
|
|
|
|
ApplicationWindow, |
|
|
|
|
gio::ActionEntry, |
|
|
|
|
prelude::{ |
|
|
|
|
ActionMapExtManual, |
|
|
|
|
GtkWindowExt |
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
pub fn new( |
|
|
|
|
app: &Application, |
|
|
|
@ -9,12 +17,8 @@ pub fn new(
@@ -9,12 +17,8 @@ pub fn new(
|
|
|
|
|
height: i32 |
|
|
|
|
) -> ApplicationWindow |
|
|
|
|
{ |
|
|
|
|
return ApplicationWindow::builder() |
|
|
|
|
|
|
|
|
|
// Relate
|
|
|
|
|
.application( |
|
|
|
|
app |
|
|
|
|
) |
|
|
|
|
// Init browser window
|
|
|
|
|
let browser = ApplicationWindow::builder() |
|
|
|
|
|
|
|
|
|
// Tuneup
|
|
|
|
|
.default_width( |
|
|
|
@ -25,6 +29,11 @@ pub fn new(
@@ -25,6 +29,11 @@ pub fn new(
|
|
|
|
|
height |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Relate
|
|
|
|
|
.application( |
|
|
|
|
app |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
// Init components
|
|
|
|
|
.titlebar( |
|
|
|
|
&header::new() |
|
|
|
@ -36,4 +45,39 @@ pub fn new(
@@ -36,4 +45,39 @@ pub fn new(
|
|
|
|
|
|
|
|
|
|
// Make
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
// Init actions
|
|
|
|
|
let action_debug = ActionEntry::builder("debug") |
|
|
|
|
|
|
|
|
|
.activate( |
|
|
|
|
|browser: &ApplicationWindow, _, _| |
|
|
|
|
{ |
|
|
|
|
browser.emit_enable_debugging( |
|
|
|
|
true |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
let action_quit = ActionEntry::builder("quit") |
|
|
|
|
|
|
|
|
|
.activate( |
|
|
|
|
|browser: &ApplicationWindow, _, _| |
|
|
|
|
{ |
|
|
|
|
browser.close(); |
|
|
|
|
} |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
.build(); |
|
|
|
|
|
|
|
|
|
browser.add_action_entries( |
|
|
|
|
[ |
|
|
|
|
action_debug, |
|
|
|
|
action_quit |
|
|
|
|
] |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// Done
|
|
|
|
|
browser |
|
|
|
|
} |