2024-02-21 22:35:49 +03:00
|
|
|
mod build_ui;
|
2024-02-22 17:09:50 +03:00
|
|
|
mod config;
|
2024-02-23 00:07:14 +03:00
|
|
|
mod save_window_size;
|
|
|
|
use config::*;
|
2024-02-21 22:35:49 +03:00
|
|
|
|
2024-02-23 00:07:14 +03:00
|
|
|
use adw::prelude::*;
|
|
|
|
use adw::*;
|
|
|
|
use gdk::Display;
|
|
|
|
use gtk::*;
|
|
|
|
use std::env;
|
2023-07-01 02:20:39 +03:00
|
|
|
|
2024-02-21 22:35:49 +03:00
|
|
|
#[derive(PartialEq, Debug, Eq, Hash, Clone, Ord, PartialOrd)]
|
|
|
|
pub struct DriverPackage {
|
|
|
|
driver: String,
|
|
|
|
version: String,
|
|
|
|
device: String,
|
|
|
|
description: String,
|
|
|
|
icon: String,
|
2024-02-21 23:28:53 +03:00
|
|
|
experimental: bool,
|
2024-02-21 22:35:49 +03:00
|
|
|
}
|
2023-07-01 02:20:39 +03:00
|
|
|
|
2024-02-21 22:35:49 +03:00
|
|
|
use build_ui::build_ui;
|
|
|
|
|
2024-02-22 00:10:03 +03:00
|
|
|
use std::boxed::Box;
|
|
|
|
|
|
|
|
// Init translations for current crate.
|
|
|
|
#[macro_use]
|
|
|
|
extern crate rust_i18n;
|
2024-02-22 17:09:50 +03:00
|
|
|
i18n!("locales", fallback = "en_US");
|
2024-02-22 00:10:03 +03:00
|
|
|
|
|
|
|
/// main function
|
2023-06-29 20:39:35 +03:00
|
|
|
fn main() {
|
2024-02-22 00:10:03 +03:00
|
|
|
let current_locale = match env::var_os("LANG") {
|
|
|
|
Some(v) => v.into_string().unwrap(),
|
|
|
|
None => panic!("$LANG is not set"),
|
|
|
|
};
|
2024-02-22 17:09:50 +03:00
|
|
|
rust_i18n::set_locale(current_locale.strip_suffix(".UTF-8").unwrap());
|
2024-02-23 00:07:14 +03:00
|
|
|
let application = adw::Application::new(Some(APP_ID), Default::default());
|
2023-06-30 18:01:45 +01:00
|
|
|
application.connect_startup(|app| {
|
|
|
|
// The CSS "magic" happens here.
|
|
|
|
let provider = CssProvider::new();
|
2024-02-22 00:10:03 +03:00
|
|
|
provider.load_from_string(include_str!("style.css"));
|
2023-06-30 18:01:45 +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,
|
|
|
|
);
|
|
|
|
app.connect_activate(build_ui);
|
|
|
|
});
|
2024-02-22 17:09:50 +03:00
|
|
|
|
2023-06-30 18:01:45 +01:00
|
|
|
application.run();
|
2024-02-23 00:07:14 +03:00
|
|
|
}
|