2024-02-20 16:11:38 +01:00
|
|
|
use std::env;
|
2024-08-04 22:56:30 +02:00
|
|
|
use gtk::{CssProvider, gdk, STYLE_PROVIDER_PRIORITY_APPLICATION, prelude::*};
|
|
|
|
use gdk::{Display};
|
2024-02-18 16:39:04 +01:00
|
|
|
mod config;
|
2024-08-04 22:56:30 +02:00
|
|
|
mod build_ui;
|
|
|
|
mod efi_error_page;
|
|
|
|
mod installer_stack_page;
|
2024-08-06 18:08:03 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
|
2024-08-05 02:25:05 +02:00
|
|
|
mod welcome_page;
|
|
|
|
mod language_page;
|
2024-08-06 18:08:03 +02:00
|
|
|
mod eula_page;
|
2024-08-06 22:56:10 +02:00
|
|
|
mod keyboard_page;
|
2024-08-07 01:02:56 +02:00
|
|
|
mod timezone_page;
|
2024-08-07 01:27:24 +02:00
|
|
|
mod partitioning_page;
|
2024-08-08 17:56:02 +02:00
|
|
|
mod automatic_partitioning_page;
|
2024-08-17 00:15:03 +02:00
|
|
|
mod manual_partitioning_page;
|
2024-08-18 00:17:57 +02:00
|
|
|
mod fstab_entry;
|
|
|
|
mod drive_mount_row;
|
2024-02-20 16:11:38 +01:00
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate rust_i18n;
|
|
|
|
i18n!("locales", fallback = "en_US");
|
|
|
|
|
2024-08-04 22:56:30 +02:00
|
|
|
fn main() -> glib::ExitCode {
|
2024-02-20 16:11:38 +01:00
|
|
|
let current_locale = match env::var_os("LANG") {
|
2024-08-04 22:56:30 +02:00
|
|
|
Some(v) => v.into_string().unwrap().chars()
|
|
|
|
.take_while(|&ch| ch != '.')
|
|
|
|
.collect::<String>(),
|
2024-02-20 16:11:38 +01:00
|
|
|
None => panic!("$LANG is not set"),
|
|
|
|
};
|
2024-08-04 22:56:30 +02:00
|
|
|
rust_i18n::set_locale(¤t_locale);
|
|
|
|
|
|
|
|
let app = adw::Application::builder().application_id(config::APP_ID).build();
|
|
|
|
|
|
|
|
app.connect_startup(|app| {
|
|
|
|
load_css();
|
|
|
|
app.connect_activate(build_ui::build_ui);
|
2024-01-14 22:31:40 +01:00
|
|
|
});
|
2024-02-18 16:39:04 +01:00
|
|
|
|
2024-08-04 22:56:30 +02:00
|
|
|
// Run the application
|
|
|
|
app.run()
|
2024-02-19 18:44:10 +01:00
|
|
|
}
|
2024-08-04 22:56:30 +02:00
|
|
|
|
|
|
|
fn load_css() {
|
|
|
|
let provider = CssProvider::new();
|
|
|
|
provider.load_from_string(include_str!("style.css"));
|
|
|
|
gtk::style_context_add_provider_for_display(
|
|
|
|
&Display::default().expect("Could not connect to a display."),
|
|
|
|
&provider,
|
|
|
|
STYLE_PROVIDER_PRIORITY_APPLICATION,
|
|
|
|
);
|
|
|
|
}
|