audrey/src/main.rs

54 lines
1.3 KiB
Rust
Raw Normal View History

2024-11-01 08:47:23 +00:00
pub const VERSION: &str = "0.1.0"; // AUDREY_VERSION
pub const USER_AGENT: &str = "audrey/linux";
pub const APP_ID: &str = "eu.callcc.audrey";
2024-11-01 08:47:03 +00:00
2024-10-29 12:01:42 +00:00
mod application;
2024-10-29 13:02:29 +00:00
pub use application::Application;
2024-10-30 06:32:21 +00:00
mod meson_config;
2024-10-29 13:02:29 +00:00
pub mod ui;
2024-10-29 12:01:42 +00:00
2024-10-30 09:06:10 +00:00
pub mod mpris;
pub use mpris::Mpris;
2024-11-05 20:44:20 +00:00
pub mod model;
2024-10-30 09:06:10 +00:00
pub mod subsonic;
2024-10-30 06:32:21 +00:00
use gettextrs::{bind_textdomain_codeset, bindtextdomain, setlocale, textdomain, LocaleCategory};
2024-10-29 12:01:42 +00:00
use gtk::prelude::*;
2024-10-29 13:02:29 +00:00
use gtk::{gio, glib};
2024-10-29 10:46:58 +00:00
2024-10-30 07:41:17 +00:00
pub mod mpv;
2024-11-04 09:12:13 +00:00
#[cfg(debug_assertions)]
fn init_tracing() {
tracing_subscriber::fmt::init();
}
#[cfg(not(debug_assertions))]
fn init_tracing() {}
2024-10-29 12:01:42 +00:00
fn main() -> glib::ExitCode {
2024-11-06 21:12:03 +00:00
// abort on any panic
let orig_hook = std::panic::take_hook();
std::panic::set_hook(Box::new(move |panic_info| {
orig_hook(panic_info);
std::process::exit(1);
}));
2024-10-29 10:46:58 +00:00
gio::resources_register_include!("audrey.gresource").expect("could not register resources");
2024-11-04 09:12:13 +00:00
init_tracing();
2024-10-29 12:01:42 +00:00
gtk::disable_setlocale();
2024-10-30 06:32:21 +00:00
bindtextdomain("audrey", meson_config::LOCALEDIR).expect("failed to bind text domain");
bind_textdomain_codeset("audrey", "UTF-8").expect("failed to bind textdomaincodeset");
textdomain("audrey").expect("unable to switch to text domain");
setlocale(LocaleCategory::LcAll, "");
setlocale(LocaleCategory::LcNumeric, "C.UTF-8");
2024-10-29 12:01:42 +00:00
let app = Application::new();
2024-11-01 08:29:59 +00:00
2024-10-29 12:01:42 +00:00
app.run()
2024-10-29 10:37:15 +00:00
}