pnmixer-rust/src/main.rs

62 lines
1.2 KiB
Rust
Raw Normal View History

2017-06-29 10:51:28 +00:00
#![feature(alloc_system)]
extern crate alloc_system;
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-29 12:25:40 +00:00
extern crate alsa;
extern crate alsa_sys;
extern crate ffi;
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-29 12:25:40 +00:00
extern crate glib_sys;
extern crate gtk;
extern crate gtk_sys;
2017-06-28 15:53:19 +00:00
extern crate libc;
2017-06-26 07:08:37 +00:00
2017-06-27 22:23:12 +00:00
use app_state::*;
2017-06-29 12:25:40 +00:00
use gtk::prelude::*;
2017-06-28 12:55:38 +00:00
use std::cell::RefCell;
use std::rc::Rc;
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-29 12:25:40 +00:00
mod app_state;
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;
2017-06-29 12:25:40 +00:00
mod myalsa;
2017-06-26 07:08:37 +00:00
2017-06-29 12:25:40 +00:00
use audio::AlsaCard;
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-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(
2017-06-29 10:51:28 +00:00
AlsaCard::new(None, Some(String::from("Master"))).unwrap(),
2017-06-28 12:55:38 +00:00
));
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-28 12:55:38 +00:00
gui_callbacks::init(apps, acard);
2017-06-26 07:08:37 +00:00
gtk::main();
}