Fully functional person editor

This commit is contained in:
Elias Projahn 2024-06-06 15:17:56 +02:00
parent f49f23a501
commit 3dc601e0f0
10 changed files with 214 additions and 43 deletions

View file

@ -67,9 +67,12 @@ mod imp {
fn signals() -> &'static [Signal] {
static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
vec![Signal::builder("role-selected")
.param_types([Role::static_type()])
.build()]
vec![
Signal::builder("role-selected")
.param_types([Role::static_type()])
.build(),
Signal::builder("create").build(),
]
});
SIGNALS.as_ref()
@ -113,6 +116,14 @@ impl MusicusRoleSelectorPopover {
})
}
pub fn connect_create<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId {
self.connect_local("create", true, move |values| {
let obj = values[0].get::<Self>().unwrap();
f(&obj);
None
})
}
#[template_callback]
fn search_changed(&self, entry: &gtk::SearchEntry) {
self.search(&entry.text());
@ -182,7 +193,7 @@ impl MusicusRoleSelectorPopover {
}
fn create(&self) {
log::info!("Create role!");
self.emit_by_name::<()>("create", &[]);
self.popdown();
}
}