From 0e0d860cd265dd84eb0ea42bb6dbbc5a6ed78169 Mon Sep 17 00:00:00 2001 From: James Westman Date: Mon, 28 Oct 2019 10:41:27 -0500 Subject: [PATCH] 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. --- podcasts-gtk/src/headerbar.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/podcasts-gtk/src/headerbar.rs b/podcasts-gtk/src/headerbar.rs index fe668c2..b8ca776 100644 --- a/podcasts-gtk/src/headerbar.rs +++ b/podcasts-gtk/src/headerbar.rs @@ -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");