From 695a1defaf59935bc790896edfcd8310bc08202f Mon Sep 17 00:00:00 2001 From: clonbg Date: Tue, 4 Jul 2023 12:53:21 +0200 Subject: [PATCH] gtk4 hello1 hello2 --- gtk4/hello1/Cargo.toml | 9 +++++++++ gtk4/hello1/src/main.rs | 9 +++++++++ gtk4/hello2/Cargo.toml | 9 +++++++++ gtk4/hello2/src/main.rs | 18 ++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 gtk4/hello1/Cargo.toml create mode 100644 gtk4/hello1/src/main.rs create mode 100644 gtk4/hello2/Cargo.toml create mode 100644 gtk4/hello2/src/main.rs diff --git a/gtk4/hello1/Cargo.toml b/gtk4/hello1/Cargo.toml new file mode 100644 index 0000000..2078574 --- /dev/null +++ b/gtk4/hello1/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello1" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +gtk = { version = "0.6.6", package = "gtk4", features = ["v4_8"] } diff --git a/gtk4/hello1/src/main.rs b/gtk4/hello1/src/main.rs new file mode 100644 index 0000000..b52c56b --- /dev/null +++ b/gtk4/hello1/src/main.rs @@ -0,0 +1,9 @@ +use gtk::prelude::*; +use gtk::{glib, Application}; + +const APP_ID: &str = "com.clonbg.Helloword1"; + +fn main() -> glib::ExitCode { + let app = Application::builder().application_id(APP_ID).build(); + app.run() +} diff --git a/gtk4/hello2/Cargo.toml b/gtk4/hello2/Cargo.toml new file mode 100644 index 0000000..76431f4 --- /dev/null +++ b/gtk4/hello2/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "hello2" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +gtk = { version = "0.6.6", package = "gtk4", features = ["v4_8"] } diff --git a/gtk4/hello2/src/main.rs b/gtk4/hello2/src/main.rs new file mode 100644 index 0000000..beb0862 --- /dev/null +++ b/gtk4/hello2/src/main.rs @@ -0,0 +1,18 @@ +use gtk::prelude::*; +use gtk::{glib, Application, ApplicationWindow}; + +const APP_ID: &str = "com.clonbg.Helloword2"; + +fn build_ui(app: &Application) { + let window = ApplicationWindow::builder() + .application(app) + .title("Mi aplicacióng gtk") + .build(); + window.present(); +} + +fn main() -> glib::ExitCode { + let app = Application::builder().application_id(APP_ID).build(); + app.connect_activate(build_ui); + app.run() +}