//! GUI demo app for Pippin extern crate gtk; use gtk::Orientation; use gtk::widgets::*; use gtk::traits; use gtk::signal::Inhibit; fn main() { if gtk::init().is_err() { println!("Failed to initialize GTK."); return; } let window = create_window(); window.connect_delete_event(|_, _| { gtk::main_quit(); Inhibit(false) }); window.show_all(); gtk::main(); } struct MyWindow { window: Window, pane: Paned, button: Button, } impl MyWindow { fn create() -> Result { let w = MyWindow { window: try!(Window::new(WindowType::Toplevel).ok_or("failed to create window")), pane: try!(Paned::new(Orientation::Horizontal)).ok_or(... } } fn create_window() -> Window { let window = gtk::Window::new(gtk::WindowType::Toplevel).unwrap(); window.set_title("Pippin GUI"); window.set_default_size(800, 600); let pane = gtk::Paned::new(Orientation::Horizontal); let button = gtk::Button::new_with_label("Does nothing").unwrap(); pane.add2(&button); window.add(&pane); }