2024-02-20 16:11:38 +01:00
|
|
|
|
2024-01-14 22:31:40 +01:00
|
|
|
// Use libraries
|
2024-02-20 16:11:38 +01:00
|
|
|
use std::env;
|
2024-02-18 16:39:04 +01:00
|
|
|
use crate::build_ui::build_ui;
|
2024-01-14 22:31:40 +01:00
|
|
|
use adw::prelude::*;
|
|
|
|
use adw::*;
|
|
|
|
use gdk::Display;
|
2024-02-16 22:21:09 +01:00
|
|
|
/// Use all gtk4 libraries (gtk4 -> gtk because cargo)
|
|
|
|
/// Use all libadwaita libraries (libadwaita -> adw because cargo)
|
2024-02-20 16:11:38 +01:00
|
|
|
use gtk::{CssProvider, STYLE_PROVIDER_PRIORITY_APPLICATION};
|
2024-02-17 14:52:07 +01:00
|
|
|
|
2024-02-18 16:39:04 +01:00
|
|
|
mod config;
|
2024-02-20 16:11:38 +01:00
|
|
|
use config::{APP_ID};
|
|
|
|
|
|
|
|
// Init translations for current crate.
|
|
|
|
#[macro_use]
|
|
|
|
extern crate rust_i18n;
|
|
|
|
i18n!("locales", fallback = "en_US");
|
|
|
|
|
2024-02-18 16:39:04 +01:00
|
|
|
|
2024-02-16 22:21:09 +01:00
|
|
|
mod automatic_partitioning;
|
2024-01-14 22:31:40 +01:00
|
|
|
mod build_ui;
|
2024-02-16 22:21:09 +01:00
|
|
|
mod done_page;
|
|
|
|
mod drive_mount_row;
|
2024-01-20 18:48:32 +01:00
|
|
|
mod efi_error_page;
|
2024-01-17 14:50:32 +01:00
|
|
|
mod eula_page;
|
2024-01-20 20:01:20 +01:00
|
|
|
mod install_page;
|
2024-02-16 22:21:09 +01:00
|
|
|
mod keyboard_page;
|
|
|
|
mod language_page;
|
2024-02-10 19:03:19 +01:00
|
|
|
mod manual_partitioning;
|
2024-02-16 22:21:09 +01:00
|
|
|
mod partitioning_page;
|
|
|
|
mod save_window_size;
|
|
|
|
mod timezone_page;
|
|
|
|
mod welcome_page;
|
2024-01-14 22:31:40 +01:00
|
|
|
|
|
|
|
/// main function
|
|
|
|
fn main() {
|
2024-02-20 16:11:38 +01:00
|
|
|
let current_locale = match env::var_os("LANG") {
|
|
|
|
Some(v) => v.into_string().unwrap(),
|
|
|
|
None => panic!("$LANG is not set"),
|
|
|
|
};
|
|
|
|
rust_i18n::set_locale(current_locale.strip_suffix(".UTF-8").unwrap());
|
2024-02-19 18:44:10 +01:00
|
|
|
let application = adw::Application::new(Some(APP_ID), Default::default());
|
2024-01-14 22:31:40 +01:00
|
|
|
application.connect_startup(|app| {
|
|
|
|
// The CSS "magic" happens here.
|
|
|
|
let provider = CssProvider::new();
|
2024-01-19 12:37:40 +01:00
|
|
|
provider.load_from_string(include_str!("style.css"));
|
2024-01-14 22:31:40 +01:00
|
|
|
// We give the CssProvided to the default screen so the CSS rules we added
|
|
|
|
// can be applied to our window.
|
|
|
|
gtk::style_context_add_provider_for_display(
|
|
|
|
&Display::default().expect("Could not connect to a display."),
|
|
|
|
&provider,
|
|
|
|
STYLE_PROVIDER_PRIORITY_APPLICATION,
|
|
|
|
);
|
2024-02-18 16:39:04 +01:00
|
|
|
app.connect_activate(build_ui);
|
2024-01-14 22:31:40 +01:00
|
|
|
});
|
2024-02-18 16:39:04 +01:00
|
|
|
|
2024-01-14 22:31:40 +01:00
|
|
|
application.run();
|
2024-02-19 18:44:10 +01:00
|
|
|
}
|