fractal/src/main.rs

61 lines
1.9 KiB
Rust
Raw Normal View History

#![doc(
2022-03-31 08:05:52 +00:00
html_logo_url = "https://gitlab.gnome.org/GNOME/fractal/-/raw/main/data/icons/org.gnome.Fractal.svg?inline=false",
html_favicon_url = "https://gitlab.gnome.org/GNOME/fractal/-/raw/main/data/icons/org.gnome.Fractal-symbolic.svg?inline=false"
)]
#![allow(clippy::new_without_default)]
mod account_switcher;
2021-02-04 19:25:29 +00:00
mod application;
mod components;
2021-02-04 19:25:29 +00:00
#[rustfmt::skip]
mod config;
mod contrib;
2022-02-14 20:53:11 +00:00
mod error_page;
mod greeter;
mod i18n;
mod login;
mod prelude;
mod secret;
mod session;
mod session_list;
mod user_facing_error;
mod utils;
mod window;
2021-02-04 19:25:29 +00:00
use gettextrs::*;
2022-01-20 08:24:22 +00:00
use gtk::{gdk::Display, gio, IconTheme};
2021-02-23 15:10:14 +00:00
use once_cell::sync::Lazy;
use self::{application::*, config::*, i18n::*, window::Window};
2022-01-20 08:24:22 +00:00
2021-02-23 15:10:14 +00:00
/// The default tokio runtime to be used for async tasks
pub static RUNTIME: Lazy<tokio::runtime::Runtime> =
Lazy::new(|| tokio::runtime::Runtime::new().unwrap());
2021-02-04 19:25:29 +00:00
fn main() {
// Initialize logger, debug is carried out via debug!, info!, and warn!.
tracing_subscriber::fmt::init();
2021-02-04 19:25:29 +00:00
// Prepare i18n
setlocale(LocaleCategory::LcAll, "");
2021-07-10 13:50:54 +00:00
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR).expect("Invalid argument passed to bindtextdomain");
textdomain(GETTEXT_PACKAGE).expect("Invalid string passed to textdomain");
2021-02-04 19:25:29 +00:00
gtk::glib::set_application_name("Fractal");
gtk::init().expect("Unable to start GTK4");
2022-01-19 20:52:19 +00:00
gst::init().expect("Failed to initialize gst");
gst_gtk::plugin_register_static().expect("Failed to initialize gstreamer gtk plugins");
2021-02-04 19:25:29 +00:00
let res = gio::Resource::load(RESOURCES_FILE).expect("Could not load gresource file");
gio::resources_register(&res);
let ui_res = gio::Resource::load(UI_RESOURCES_FILE).expect("Could not load UI gresource file");
gio::resources_register(&ui_res);
2021-02-04 19:25:29 +00:00
2021-04-20 17:06:36 +00:00
IconTheme::for_display(&Display::default().unwrap())
2022-03-29 09:12:08 +00:00
.add_resource_path("/org/gnome/Fractal/icons");
2021-04-13 18:21:45 +00:00
let app = Application::new();
2021-02-04 19:25:29 +00:00
app.run();
}