init browser modules

This commit is contained in:
yggverse 2024-09-18 20:33:29 +03:00
parent 0f81beb26b
commit 6f9863d0e7
5 changed files with 41 additions and 13 deletions

View File

@ -4,4 +4,4 @@ version = "0.1.0"
edition = "2021"
[dependencies]
gtk4 = "0.9.1"
gtk4 = { version = "0.9.1", features = ["v4_6"] }

15
src/app/browser.rs Normal file
View File

@ -0,0 +1,15 @@
#[path = "browser/header.rs"] mod header;
#[path = "browser/main.rs"] mod main;
use gtk4 as gtk;
use gtk::{Application, ApplicationWindow};
pub fn new(app: &Application) -> ApplicationWindow
{
return ApplicationWindow::builder().application(app)
.default_width(640)
.default_height(480)
//.titlebar(&header::new())
.child(&main::new())
.build();
}

View File

@ -0,0 +1,7 @@
use gtk4 as gtk;
use gtk::HeaderBar;
pub fn new() -> HeaderBar
{
return HeaderBar::builder().build();
}

9
src/app/browser/main.rs Normal file
View File

@ -0,0 +1,9 @@
use gtk4 as gtk;
use gtk::Box;
pub fn new() -> Box
{
return Box::builder().orientation(
gtk::Orientation::Vertical
).build();
}

View File

@ -1,24 +1,21 @@
#[path = "app/browser.rs"] mod browser;
use gtk4 as gtk;
use gtk::prelude::*;
use gtk::{glib, Application, ApplicationWindow};
use gtk::{glib, Application};
fn main() -> glib::ExitCode
{
let app = Application::builder()
.application_id("io.github.yggverse.Yoda.app")
.build();
let app = Application::builder().application_id(
"io.github.yggverse.Yoda.app"
).build();
app.connect_activate(
|app|
{
let window = ApplicationWindow::builder()
.application(app)
.default_width(640)
.default_height(480)
.title("Yoda")
.build();
window.present();
browser::new(
app
).present();
}
);