mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
draft suggestion autocomplete feature
This commit is contained in:
parent
1c4bde4004
commit
5b0de227c0
7 changed files with 201 additions and 4 deletions
|
|
@ -2,6 +2,7 @@ mod database;
|
|||
mod identity;
|
||||
mod primary_icon;
|
||||
mod search;
|
||||
mod suggestion;
|
||||
|
||||
use super::{ItemAction, Profile};
|
||||
use adw::{prelude::AdwDialogExt, AlertDialog};
|
||||
|
|
@ -14,6 +15,7 @@ use gtk::{
|
|||
use primary_icon::PrimaryIcon;
|
||||
use sqlite::Transaction;
|
||||
use std::{cell::Cell, rc::Rc};
|
||||
use suggestion::Suggestion;
|
||||
|
||||
const PREFIX_DOWNLOAD: &str = "download:";
|
||||
const PREFIX_SOURCE: &str = "source:";
|
||||
|
|
@ -79,6 +81,9 @@ impl Request for Entry {
|
|||
// Detect primary icon on construct
|
||||
entry.update_primary_icon(profile);
|
||||
|
||||
// Init additional features
|
||||
let suggestion = Suggestion::build(&entry);
|
||||
|
||||
// Connect events
|
||||
entry.connect_icon_release({
|
||||
let profile = profile.clone();
|
||||
|
|
@ -108,6 +113,11 @@ impl Request for Entry {
|
|||
// Update icons
|
||||
this.update_primary_icon(&profile);
|
||||
this.update_secondary_icon();
|
||||
|
||||
// Show search suggestions
|
||||
if this.focus_child().is_some() {
|
||||
suggestion.update(&profile, this, None);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue