Initial commit
This commit is contained in:
commit
2a7984da34
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/target/
|
||||
**/*.rs.bk
|
30
Cargo.toml
Normal file
30
Cargo.toml
Normal file
@ -0,0 +1,30 @@
|
||||
[package]
|
||||
name = "pigui"
|
||||
version = "0.1.0"
|
||||
authors = ["Julian Ospald <hasufell@posteo.de>"]
|
||||
|
||||
[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"
|
58
data/ui/window.glade
Normal file
58
data/ui/window.glade
Normal file
@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.20.0 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="main">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="title" translatable="yes">Pigui</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child internal-child="selection">
|
||||
<object class="GtkTreeSelection"/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
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;
|
Loading…
Reference in New Issue
Block a user