pnmixer-rust/src/main.rs

62 lines
1.3 KiB
Rust
Raw Normal View History

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;
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::*;
use std::cell::Cell;
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
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"),
builder_popup: gtk::Builder::new_from_string(include_str!("../data/ui/popup-window-vertical.glade")),
};
let alsa_card = audio::get_default_alsa_card();
let mixer = audio::get_mixer(&alsa_card).unwrap();
let selem = audio::get_selem_by_name(
&mixer,
String::from("Master"),
).unwrap();
let ref acard = AlsaCard {
card: Cell::new(alsa_card),
mixer: Cell::new(mixer),
selem: Cell::new(selem),
};
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-27 22:23:12 +00:00
gui_callbacks::init(apps);
2017-06-26 07:08:37 +00:00
gtk::main();
}