headerbar: Add activate handler to add entry

This way, pressing Enter after typing/pasting a URL adds the podcast
feed, instead of needing to press the button separately.
This commit is contained in:
James Westman 2019-10-28 10:41:27 -05:00
parent a8246a96cd
commit 0e0d860cd2

View File

@ -244,6 +244,16 @@ impl Header {
weak.upgrade().map(|h| h.add.on_add_clicked(&sender));
}));
s.add
.entry
.connect_activate(clone!(weak, sender => move |_| {
weak.upgrade().map(|h| {
if h.add.add.get_sensitive() {
h.add.on_add_clicked(&sender);
}
});
}));
s.back.connect_clicked(clone!(weak, sender => move |_| {
weak.upgrade().map(|h| h.switch_to_normal());
sender.send(Action::ShowShowsAnimated).expect("Action channel blew up somehow");