define browser entities as structs

This commit is contained in:
yggverse 2024-09-22 02:00:54 +03:00
parent 3fbfe6a7e0
commit c0ebe95eb8
4 changed files with 84 additions and 40 deletions

View file

@ -1,14 +1,34 @@
mod tab;
use std::sync::Arc;
use gtk::prelude::BoxExt;
use gtk::Box;
pub fn new() -> Box {
let main = Box::builder()
.orientation(gtk::Orientation::Vertical)
.build();
main.append(&tab::new());
main
pub struct Main {
pub widget: Arc<gtk::Box>,
pub tab: Arc<tab::Tab>,
}
impl Main {
pub fn tab_append(&self) {
self.tab.append(true);
}
}
pub fn new() -> Main {
// Init components
let tab = Arc::new(tab::new());
// Init widget
let widget = Arc::new(
Box::builder()
.orientation(gtk::Orientation::Vertical)
.build(),
);
widget.append(tab.widget.as_ref());
// Init struct
Main { widget, tab }
}