pnmixer-rust/src/main.rs

67 lines
1.2 KiB
Rust
Raw Normal View History

2017-06-28 23:35:30 +00:00
2017-06-26 21:52:21 +00:00
extern crate flexi_logger;
#[macro_use]
extern crate log;
2017-06-27 13:56:33 +00:00
#[macro_use]
extern crate error_chain;
2017-06-26 07:08:37 +00:00
extern crate gtk;
2017-06-26 21:52:21 +00:00
extern crate gtk_sys;
2017-06-26 07:08:37 +00:00
extern crate gdk;
2017-06-26 15:56:09 +00:00
extern crate gdk_sys;
2017-06-26 07:08:37 +00:00
extern crate alsa;
2017-06-28 15:53:19 +00:00
extern crate libc;
2017-06-26 07:08:37 +00:00
use gtk::prelude::*;
2017-06-26 15:56:09 +00:00
use gdk_sys::GDK_KEY_Escape;
2017-06-27 22:23:12 +00:00
use app_state::*;
2017-06-28 12:55:38 +00:00
use std::cell::RefCell;
use std::rc::Rc;
2017-06-27 22:23:12 +00:00
use std::boxed::Box;
2017-06-26 15:56:09 +00:00
2017-06-27 13:56:33 +00:00
#[macro_use]
mod errors;
2017-06-26 15:56:09 +00:00
2017-06-26 07:08:37 +00:00
mod audio;
2017-06-26 15:56:09 +00:00
mod gui;
2017-06-27 22:23:12 +00:00
mod gui_callbacks;
mod app_state;
2017-06-26 07:08:37 +00:00
2017-06-28 12:55:38 +00:00
2017-06-26 07:08:37 +00:00
fn main() {
gtk::init().unwrap();
2017-06-28 23:35:30 +00:00
let x = 4 / 0;
println!("Zero: {}", x);
2017-06-27 22:23:12 +00:00
let ref apps = AppS {
status_icon: gtk::StatusIcon::new_from_icon_name("pnmixer"),
2017-06-28 12:55:38 +00:00
builder_popup: gtk::Builder::new_from_string(
include_str!("../data/ui/popup-window-vertical.glade"),
),
2017-06-27 22:23:12 +00:00
};
2017-06-28 12:55:38 +00:00
let acard = Rc::new(RefCell::new(
AlsaCard::new(
2017-06-28 23:35:30 +00:00
None,
2017-06-28 12:55:38 +00:00
Some(String::from("Master")),
).unwrap(),
));
2017-06-27 22:23:12 +00:00
2017-06-26 21:52:21 +00:00
flexi_logger::LogOptions::new()
.log_to_file(false)
// ... your configuration options go here ...
.init(Some("info".to_string()))
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
2017-06-26 07:08:37 +00:00
2017-06-28 12:55:38 +00:00
gui_callbacks::init(apps, acard);
2017-06-26 07:08:37 +00:00
gtk::main();
}