| 
									
										
										
										
											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-10-09 12:22:02 +02:00
										 |  |  | mod backend;
 | 
					
						
							| 
									
										
										
										
											2020-12-02 15:41:19 +01:00
										 |  |  | mod config;
 | 
					
						
							| 
									
										
										
										
											2020-09-28 14:15:59 +02:00
										 |  |  | mod database;
 | 
					
						
							| 
									
										
										
										
											2020-09-28 15:02:19 +02:00
										 |  |  | mod dialogs;
 | 
					
						
							| 
									
										
										
										
											2020-12-02 15:41:19 +01:00
										 |  |  | mod editors;
 | 
					
						
							| 
									
										
										
										
											2021-01-13 17:51:00 +01:00
										 |  |  | mod import;
 | 
					
						
							| 
									
										
										
										
											2020-11-07 16:11:08 +01:00
										 |  |  | mod player;
 | 
					
						
							| 
									
										
										
										
											2020-10-16 21:24:55 +02:00
										 |  |  | mod screens;
 | 
					
						
							| 
									
										
										
										
											2020-12-02 15:41:19 +01:00
										 |  |  | mod selectors;
 | 
					
						
							| 
									
										
										
										
											2020-10-16 21:24:55 +02:00
										 |  |  | 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-12-20 11:47:27 +01:00
										 |  |  |     gstreamer::init().expect("Failed to initialize GStreamer!");
 | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-02 15:41:19 +01:00
										 |  |  |     let app = gtk::Application::new(Some("de.johrpan.musicus"), gio::ApplicationFlags::empty())
 | 
					
						
							|  |  |  |         .expect("Failed to initialize GTK application!");
 | 
					
						
							| 
									
										
										
										
											2020-09-27 21:58:42 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											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);
 | 
					
						
							|  |  |  | }
 |