2024-09-18 20:33:29 +03:00
|
|
|
#[path = "browser/header.rs"] mod header;
|
|
|
|
#[path = "browser/main.rs"] mod main;
|
|
|
|
|
2024-09-19 18:08:09 +03:00
|
|
|
use gtk::{
|
|
|
|
Application,
|
|
|
|
ApplicationWindow,
|
|
|
|
gio::ActionEntry,
|
|
|
|
prelude::{
|
|
|
|
ActionMapExtManual,
|
|
|
|
GtkWindowExt
|
|
|
|
}
|
|
|
|
};
|
2024-09-18 20:33:29 +03:00
|
|
|
|
2024-09-19 00:34:46 +03:00
|
|
|
pub fn new(
|
2024-09-19 00:37:54 +03:00
|
|
|
app: &Application,
|
|
|
|
width: i32,
|
|
|
|
height: i32
|
2024-09-19 00:34:46 +03:00
|
|
|
) -> ApplicationWindow
|
2024-09-18 20:33:29 +03:00
|
|
|
{
|
2024-09-19 18:08:09 +03:00
|
|
|
// Init browser window
|
|
|
|
let browser = ApplicationWindow::builder()
|
2024-09-19 00:34:46 +03:00
|
|
|
|
|
|
|
// Tuneup
|
|
|
|
.default_width(
|
|
|
|
width
|
|
|
|
)
|
|
|
|
|
|
|
|
.default_height(
|
|
|
|
height
|
|
|
|
)
|
|
|
|
|
2024-09-19 18:08:09 +03:00
|
|
|
// Relate
|
|
|
|
.application(
|
|
|
|
app
|
|
|
|
)
|
|
|
|
|
2024-09-19 00:34:46 +03:00
|
|
|
// Init components
|
|
|
|
.titlebar(
|
|
|
|
&header::new()
|
|
|
|
)
|
|
|
|
|
|
|
|
.child(
|
|
|
|
&main::new()
|
|
|
|
)
|
|
|
|
|
|
|
|
// Make
|
|
|
|
.build();
|
2024-09-19 18:08:09 +03:00
|
|
|
|
|
|
|
// 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
|
2024-09-18 20:33:29 +03:00
|
|
|
}
|