mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-27 04:07:25 +01:00
Fully functional person editor
This commit is contained in:
parent
f49f23a501
commit
3dc601e0f0
10 changed files with 214 additions and 43 deletions
|
|
@ -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: >k::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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue