pika-first-setup/src/build_ui.rs

39 lines
1.1 KiB
Rust
Raw Normal View History

2024-01-30 21:33:07 +01:00
// GTK crates
2024-02-08 22:49:42 +01:00
use adw::prelude::*;
use adw::*;
2024-02-09 23:09:54 +01:00
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
use crate::config::APP_ICON;
2024-01-30 21:33:07 +01:00
// application crates
2024-01-31 19:48:55 +01:00
/// first setup crates
2024-02-18 11:49:06 +01:00
use crate::first_setup::*;
2024-01-30 21:33:07 +01:00
pub fn build_ui(app: &adw::Application) {
// setup glib
gtk::glib::set_prgname(Some(t!("app_name").to_string()));
glib::set_application_name(&t!("app_name").to_string());
2024-01-30 21:33:07 +01:00
// create the main Application window
let window = adw::ApplicationWindow::builder()
// The text on the titlebar
.title(t!("app_name"))
2024-01-30 21:33:07 +01:00
// link it to the application "app"
.application(app)
2024-01-31 19:48:55 +01:00
// Add the box called "window_box" to it
2024-01-30 21:33:07 +01:00
// Application icon
.icon_name(APP_ICON)
2024-01-30 21:33:07 +01:00
// Minimum Size/Default
.width_request(700)
.height_request(500)
2024-01-30 21:47:31 +01:00
.deletable(false)
2024-01-30 21:33:07 +01:00
// Startup
2024-01-30 21:47:31 +01:00
.startup_id("com.github.pikaos-linux.pikafirstsetup")
2024-01-30 21:33:07 +01:00
// build the window
.build();
2024-01-31 19:48:55 +01:00
first_setup(&window);
2024-01-30 21:33:07 +01:00
// show the window
window.present()
2024-02-08 22:49:42 +01:00
}