commit 2a7984da3457a69006c80b93db4920c76c6577ad Author: Julian Ospald Date: Thu Sep 7 17:30:35 2017 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..eccd7b4 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target/ +**/*.rs.bk diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..393f9ef --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,30 @@ +[package] +name = "pigui" +version = "0.1.0" +authors = ["Julian Ospald "] + +[dependencies] +error-chain = "^0.10.0" +flexi_logger = "^0.6.8" +glib = "^0.3.1" +glib-sys = "^0.4.0" +gobject-sys = "^0.4.0" +gtk-sys = "^0.4.0" +libpijul = "^0.7.3" +log = "^0.3.8" + +[dependencies.gdk] +features = [ + "v3_10", + "v3_12", + "v3_22", +] +version = "^0.6.0" + +[dependencies.gtk] +features = [ + "v3_10", + "v3_12", + "v3_22", +] +version = "^0.2.0" diff --git a/data/ui/window.glade b/data/ui/window.glade new file mode 100644 index 0000000..0e922fc --- /dev/null +++ b/data/ui/window.glade @@ -0,0 +1,58 @@ + + + + + + False + Pigui + + + True + False + vertical + + + True + False + + + True + True + + + + + + True + True + 0 + + + + + True + True + + + + + + True + True + 1 + + + + + True + True + 0 + + + + + + + + + diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..8936731 --- /dev/null +++ b/src/main.rs @@ -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(); +} diff --git a/src/ui/entry.rs b/src/ui/entry.rs new file mode 100644 index 0000000..0b12d64 --- /dev/null +++ b/src/ui/entry.rs @@ -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) { + appstate.gui.window.show_all(); +} + diff --git a/src/ui/mod.rs b/src/ui/mod.rs new file mode 100644 index 0000000..e3dbce6 --- /dev/null +++ b/src/ui/mod.rs @@ -0,0 +1,3 @@ +//! The UI subsystem. + +pub mod entry;