move identity feature to request area

This commit is contained in:
yggverse 2025-01-29 15:13:35 +02:00
parent 78957ff85b
commit 2dc6154d54
32 changed files with 59 additions and 84 deletions

View file

@ -1,6 +1,8 @@
mod database;
mod identity;
mod primary_icon;
use adw::prelude::AdwDialogExt;
use primary_icon::PrimaryIcon;
use super::{ItemAction, Profile};
@ -71,8 +73,25 @@ impl Request for Entry {
// Connect events
entry.connect_icon_release({
let item_action = item_action.clone();
let profile = profile.clone();
move |this, position| match position {
EntryIconPosition::Primary => item_action.ident.activate(), // @TODO PrimaryIcon impl
EntryIconPosition::Primary => {
if let Some(request) = this.uri() {
if ["gemini", "titan"].contains(&request.scheme().as_str()) {
return identity::default(&profile, &request, {
let item_action = item_action.clone();
let profile = profile.clone();
let this = this.clone();
move || {
this.update(&profile);
item_action.load.activate(Some(&this.text()), false);
} // on apply
})
.present(Some(this));
}
}
identity::unsupported().present(Some(this));
}
EntryIconPosition::Secondary => item_action.load.activate(Some(&this.text()), true),
_ => todo!(), // unexpected
}