2024-09-20 18:02:10 +03:00
|
|
|
mod header;
|
|
|
|
mod main;
|
2024-09-18 20:33:29 +03:00
|
|
|
|
2024-09-19 18:08:09 +03:00
|
|
|
use gtk::{
|
|
|
|
gio::ActionEntry,
|
2024-09-20 18:02:10 +03:00
|
|
|
prelude::{ActionMapExtManual, GtkWindowExt},
|
|
|
|
Application, ApplicationWindow,
|
2024-09-19 18:08:09 +03:00
|
|
|
};
|
2024-09-18 20:33:29 +03:00
|
|
|
|
2024-09-21 20:48:12 +03:00
|
|
|
use sqlite::Connection;
|
|
|
|
|
|
|
|
pub fn new(app: &Application, db: &Connection, width: i32, height: i32) -> ApplicationWindow {
|
2024-09-19 18:08:09 +03:00
|
|
|
// Init browser window
|
|
|
|
let browser = ApplicationWindow::builder()
|
2024-09-20 18:02:10 +03:00
|
|
|
.default_width(width)
|
|
|
|
.default_height(height)
|
|
|
|
.application(app)
|
|
|
|
.titlebar(&header::new())
|
|
|
|
.child(&main::new())
|
2024-09-19 00:34:46 +03:00
|
|
|
.build();
|
2024-09-19 18:08:09 +03:00
|
|
|
|
2024-09-20 18:02:10 +03:00
|
|
|
// Init actions
|
|
|
|
let action_debug = ActionEntry::builder("debug")
|
|
|
|
.activate(|browser: &ApplicationWindow, _, _| {
|
|
|
|
browser.emit_enable_debugging(true);
|
|
|
|
})
|
|
|
|
.build();
|
2024-09-19 18:08:09 +03:00
|
|
|
|
2024-09-20 18:02:10 +03:00
|
|
|
let action_quit = ActionEntry::builder("quit")
|
|
|
|
.activate(|browser: &ApplicationWindow, _, _| {
|
|
|
|
browser.close();
|
|
|
|
})
|
|
|
|
.build();
|
2024-09-19 18:08:09 +03:00
|
|
|
|
2024-09-20 18:02:10 +03:00
|
|
|
browser.add_action_entries([action_debug, action_quit]);
|
2024-09-19 18:08:09 +03:00
|
|
|
|
|
|
|
// Done
|
|
|
|
browser
|
2024-09-20 18:02:10 +03:00
|
|
|
}
|