mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-02-05 16:04:15 +00:00
init browser modules
This commit is contained in:
parent
0f81beb26b
commit
6f9863d0e7
@ -4,4 +4,4 @@ version = "0.1.0"
|
|||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
gtk4 = "0.9.1"
|
gtk4 = { version = "0.9.1", features = ["v4_6"] }
|
||||||
|
15
src/app/browser.rs
Normal file
15
src/app/browser.rs
Normal 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();
|
||||||
|
}
|
7
src/app/browser/header.rs
Normal file
7
src/app/browser/header.rs
Normal 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
9
src/app/browser/main.rs
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
use gtk4 as gtk;
|
||||||
|
use gtk::Box;
|
||||||
|
|
||||||
|
pub fn new() -> Box
|
||||||
|
{
|
||||||
|
return Box::builder().orientation(
|
||||||
|
gtk::Orientation::Vertical
|
||||||
|
).build();
|
||||||
|
}
|
21
src/main.rs
21
src/main.rs
@ -1,24 +1,21 @@
|
|||||||
|
#[path = "app/browser.rs"] mod browser;
|
||||||
|
|
||||||
use gtk4 as gtk;
|
use gtk4 as gtk;
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
use gtk::{glib, Application, ApplicationWindow};
|
use gtk::{glib, Application};
|
||||||
|
|
||||||
fn main() -> glib::ExitCode
|
fn main() -> glib::ExitCode
|
||||||
{
|
{
|
||||||
let app = Application::builder()
|
let app = Application::builder().application_id(
|
||||||
.application_id("io.github.yggverse.Yoda.app")
|
"io.github.yggverse.Yoda.app"
|
||||||
.build();
|
).build();
|
||||||
|
|
||||||
app.connect_activate(
|
app.connect_activate(
|
||||||
|app|
|
|app|
|
||||||
{
|
{
|
||||||
let window = ApplicationWindow::builder()
|
browser::new(
|
||||||
.application(app)
|
app
|
||||||
.default_width(640)
|
).present();
|
||||||
.default_height(480)
|
|
||||||
.title("Yoda")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
window.present();
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user