mirror of
https://github.com/johrpan/musicus.git
synced 2025-10-26 19:57:25 +01:00
Allow removing tags via the button
This commit is contained in:
parent
af57fe020c
commit
a790d913af
3 changed files with 50 additions and 5 deletions
|
|
@ -147,6 +147,19 @@ impl MusicusSearchEntry {
|
|||
pub fn add_tag(&self, tag: Tag) {
|
||||
self.imp().text.set_text("");
|
||||
let tag = MusicusSearchTag::new(tag);
|
||||
|
||||
tag.connect_remove(clone!(@weak self as self_ => move |tag| {
|
||||
let imp = self_.imp();
|
||||
|
||||
imp.tags_box.remove(tag);
|
||||
|
||||
{
|
||||
imp.tags.borrow_mut().retain(|t| t.tag() != tag.tag());
|
||||
}
|
||||
|
||||
self_.emit_by_name::<()>("query-changed", &[]);
|
||||
}));
|
||||
|
||||
self.imp().tags_box.append(&tag);
|
||||
self.imp().tags.borrow_mut().push(tag);
|
||||
self.emit_by_name::<()>("query-changed", &[]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue