mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 11:47:25 +01:00
Add person editor dialog
This commit is contained in:
parent
c67cefb38a
commit
9fcab517e4
6 changed files with 200 additions and 11 deletions
|
|
@ -1,40 +1,58 @@
|
|||
use super::database::*;
|
||||
use super::dialogs::*;
|
||||
use gio::prelude::*;
|
||||
use glib::clone;
|
||||
use gtk::prelude::*;
|
||||
use gtk_macros::{action, get_widget};
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
||||
pub struct Window {
|
||||
window: gtk::ApplicationWindow,
|
||||
db: Rc<Database>,
|
||||
}
|
||||
|
||||
impl Window {
|
||||
pub fn new(app: >k::Application) -> Self {
|
||||
pub fn new(app: >k::Application) -> Rc<Self> {
|
||||
let builder = gtk::Builder::from_resource("/de/johrpan/musicus_editor/ui/window.ui");
|
||||
|
||||
get_widget!(builder, gtk::ApplicationWindow, window);
|
||||
|
||||
action!(window, "add-person", |_, _| {
|
||||
println!("TODO: Add person.");
|
||||
let db = Rc::new(Database::new("test.sqlite"));
|
||||
|
||||
let result = Rc::new(Window {
|
||||
window: window,
|
||||
db: db,
|
||||
});
|
||||
|
||||
action!(window, "add-instrument", |_, _| {
|
||||
action!(
|
||||
result.window,
|
||||
"add-person",
|
||||
clone!(@strong result => move |_, _| {
|
||||
PersonEditor::new(result.db.clone(), &result.window, None, |person| {
|
||||
println!("{:?}", person);
|
||||
}).show();
|
||||
})
|
||||
);
|
||||
|
||||
action!(result.window, "add-instrument", |_, _| {
|
||||
println!("TODO: Add instrument.");
|
||||
});
|
||||
|
||||
action!(window, "add-work", |_, _| {
|
||||
action!(result.window, "add-work", |_, _| {
|
||||
println!("TODO: Add work.");
|
||||
});
|
||||
|
||||
action!(window, "add-ensemble", |_, _| {
|
||||
action!(result.window, "add-ensemble", |_, _| {
|
||||
println!("TODO: Add ensemble.");
|
||||
});
|
||||
|
||||
action!(window, "add-recording", |_, _| {
|
||||
action!(result.window, "add-recording", |_, _| {
|
||||
println!("TODO: Add recording.");
|
||||
});
|
||||
|
||||
window.set_application(Some(app));
|
||||
result.window.set_application(Some(app));
|
||||
|
||||
Window { window: window }
|
||||
result
|
||||
}
|
||||
|
||||
pub fn present(&self) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue