Initial commit
This commit is contained in:
37
src/main.rs
Normal file
37
src/main.rs
Normal file
@@ -0,0 +1,37 @@
|
||||
#![feature(alloc_system)]
|
||||
extern crate alloc_system;
|
||||
|
||||
|
||||
extern crate gdk;
|
||||
extern crate glib;
|
||||
extern crate glib_sys;
|
||||
extern crate gobject_sys;
|
||||
extern crate gtk;
|
||||
extern crate gtk_sys;
|
||||
|
||||
extern crate flexi_logger;
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
#[macro_use]
|
||||
extern crate error_chain;
|
||||
|
||||
mod ui;
|
||||
|
||||
use ui::entry::*;
|
||||
use std::rc::Rc;
|
||||
|
||||
|
||||
fn main() {
|
||||
gtk::init().unwrap();
|
||||
|
||||
flexi_logger::LogOptions::new()
|
||||
.log_to_file(false)
|
||||
.init(Some("pnmixer=debug".to_string()))
|
||||
.unwrap_or_else(|e| panic!("Logger initialization failed with {}", e));
|
||||
|
||||
let apps = Rc::new(AppS::new());
|
||||
ui::entry::init(apps);
|
||||
|
||||
gtk::main();
|
||||
}
|
||||
42
src/ui/entry.rs
Normal file
42
src/ui/entry.rs
Normal file
@@ -0,0 +1,42 @@
|
||||
use gtk;
|
||||
use std::rc::Rc;
|
||||
use gtk::WidgetExt;
|
||||
|
||||
|
||||
pub struct AppS {
|
||||
_cant_construct: (),
|
||||
pub gui: Gui,
|
||||
}
|
||||
|
||||
|
||||
impl AppS {
|
||||
pub fn new() -> Self {
|
||||
let builder = gtk::Builder::new_from_string(include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/data/ui/window.glade")));
|
||||
|
||||
return AppS {
|
||||
_cant_construct: (),
|
||||
gui: Gui::new(builder),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct Gui {
|
||||
_cant_construct: (),
|
||||
pub window: gtk::Window
|
||||
}
|
||||
|
||||
impl Gui {
|
||||
pub fn new(builder: gtk::Builder) -> Self {
|
||||
return Gui {
|
||||
_cant_construct: (),
|
||||
window: builder.get_object("main").unwrap(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn init(appstate: Rc<AppS>) {
|
||||
appstate.gui.window.show_all();
|
||||
}
|
||||
|
||||
3
src/ui/mod.rs
Normal file
3
src/ui/mod.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
//! The UI subsystem.
|
||||
|
||||
pub mod entry;
|
||||
Reference in New Issue
Block a user