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