mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 08:35:28 +00:00
hide suggestion popover on activate navigation entry
This commit is contained in:
parent
907dcd4893
commit
3e4423eca7
2 changed files with 15 additions and 7 deletions
|
|
@ -103,12 +103,12 @@ impl Request for Entry {
|
|||
entry.connect_has_focus_notify(|this| this.update_secondary_icon());
|
||||
|
||||
suggestion
|
||||
.clone()
|
||||
.signal_handler_id
|
||||
.borrow_mut()
|
||||
.replace(entry.connect_changed({
|
||||
let profile = profile.clone();
|
||||
let item_action = item_action.clone();
|
||||
let suggestion = suggestion.clone();
|
||||
move |this| {
|
||||
// Update actions
|
||||
item_action.reload.set_enabled(!this.text().is_empty());
|
||||
|
|
@ -127,8 +127,11 @@ impl Request for Entry {
|
|||
|
||||
entry.connect_activate({
|
||||
let item_action = item_action.clone();
|
||||
move |this| {
|
||||
item_action.load.activate(Some(&this.text()), true);
|
||||
let suggestion = suggestion.clone();
|
||||
move |_| {
|
||||
use gtk::prelude::ActionExt;
|
||||
item_action.reload.activate(None);
|
||||
suggestion.hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ pub struct Suggestion {
|
|||
list_store: ListStore,
|
||||
request: Entry,
|
||||
profile: Rc<Profile>,
|
||||
popover: Popover,
|
||||
pub signal_handler_id: Rc<RefCell<Option<SignalHandlerId>>>,
|
||||
pub popover: Popover,
|
||||
}
|
||||
|
||||
impl Suggestion {
|
||||
|
|
@ -133,6 +133,8 @@ impl Suggestion {
|
|||
}
|
||||
}
|
||||
|
||||
// Actions
|
||||
|
||||
pub fn update(&self, limit: Option<usize>) {
|
||||
use gtk::prelude::EditableExt;
|
||||
use itertools::Itertools;
|
||||
|
|
@ -155,12 +157,15 @@ impl Suggestion {
|
|||
.child()
|
||||
.unwrap()
|
||||
.downcast_ref::<gtk::ScrolledWindow>()
|
||||
.unwrap()
|
||||
.set_height_request(-1);
|
||||
.unwrap();
|
||||
self.popover.popup();
|
||||
return;
|
||||
}
|
||||
}
|
||||
self.popover.popdown();
|
||||
self.hide();
|
||||
}
|
||||
|
||||
pub fn hide(&self) {
|
||||
self.popover.popdown()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue