mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
54 lines
1.3 KiB
Rust
54 lines
1.3 KiB
Rust
// Required for database/schema.rs
|
|
#[macro_use]
|
|
extern crate diesel;
|
|
|
|
// Required for embed_migrations macro in database/database.rs
|
|
#[macro_use]
|
|
extern crate diesel_migrations;
|
|
|
|
use gio::prelude::*;
|
|
use glib::clone;
|
|
use std::cell::RefCell;
|
|
use std::rc::Rc;
|
|
|
|
mod config;
|
|
mod backend;
|
|
mod database;
|
|
mod dialogs;
|
|
mod player;
|
|
mod screens;
|
|
mod widgets;
|
|
|
|
mod window;
|
|
use window::Window;
|
|
|
|
mod resources;
|
|
|
|
fn main() {
|
|
gettextrs::setlocale(gettextrs::LocaleCategory::LcAll, "");
|
|
gettextrs::bindtextdomain("musicus", config::LOCALEDIR);
|
|
gettextrs::textdomain("musicus");
|
|
|
|
gtk::init().expect("Failed to initialize GTK!");
|
|
libhandy::init();
|
|
resources::init().expect("Failed to initialize resources!");
|
|
|
|
let app = gtk::Application::new(
|
|
Some("de.johrpan.musicus"),
|
|
gio::ApplicationFlags::empty(),
|
|
)
|
|
.expect("Failed to initialize GTK application!");
|
|
|
|
let window: RefCell<Option<Rc<Window>>> = RefCell::new(None);
|
|
|
|
app.connect_activate(clone!(@strong app => move |_| {
|
|
let mut window = window.borrow_mut();
|
|
if window.is_none() {
|
|
window.replace(Window::new(&app));
|
|
}
|
|
window.as_ref().unwrap().present();
|
|
}));
|
|
|
|
let args = std::env::args().collect::<Vec<String>>();
|
|
app.run(&args);
|
|
}
|