2020-09-28 14:15:59 +02:00
|
|
|
// 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;
|
|
|
|
|
|
2020-09-27 21:58:42 +02:00
|
|
|
use gio::prelude::*;
|
|
|
|
|
use glib::clone;
|
|
|
|
|
use std::cell::RefCell;
|
2020-09-28 15:02:19 +02:00
|
|
|
use std::rc::Rc;
|
2020-09-27 21:58:42 +02:00
|
|
|
|
2020-11-02 00:52:04 +01:00
|
|
|
mod config;
|
2020-10-09 12:22:02 +02:00
|
|
|
mod backend;
|
2020-09-28 14:15:59 +02:00
|
|
|
mod database;
|
2020-09-28 15:02:19 +02:00
|
|
|
mod dialogs;
|
2020-10-16 21:24:55 +02:00
|
|
|
mod screens;
|
|
|
|
|
mod widgets;
|
2020-09-28 14:15:59 +02:00
|
|
|
|
2020-09-27 21:58:42 +02:00
|
|
|
mod window;
|
|
|
|
|
use window::Window;
|
|
|
|
|
|
2020-11-01 17:37:04 +01:00
|
|
|
mod resources;
|
|
|
|
|
|
2020-09-27 21:58:42 +02:00
|
|
|
fn main() {
|
2020-11-02 00:52:04 +01:00
|
|
|
gettextrs::setlocale(gettextrs::LocaleCategory::LcAll, "");
|
|
|
|
|
gettextrs::bindtextdomain("musicus", config::LOCALEDIR);
|
|
|
|
|
gettextrs::textdomain("musicus");
|
|
|
|
|
|
2020-09-28 20:51:56 +02:00
|
|
|
gtk::init().expect("Failed to initialize GTK!");
|
|
|
|
|
libhandy::init();
|
2020-11-01 17:37:04 +01:00
|
|
|
resources::init().expect("Failed to initialize resources!");
|
2020-09-27 21:58:42 +02:00
|
|
|
|
|
|
|
|
let app = gtk::Application::new(
|
2020-11-01 12:49:10 +01:00
|
|
|
Some("de.johrpan.musicus"),
|
2020-09-27 21:58:42 +02:00
|
|
|
gio::ApplicationFlags::empty(),
|
|
|
|
|
)
|
|
|
|
|
.expect("Failed to initialize GTK application!");
|
|
|
|
|
|
2020-09-28 15:02:19 +02:00
|
|
|
let window: RefCell<Option<Rc<Window>>> = RefCell::new(None);
|
2020-09-27 21:58:42 +02:00
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|