mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
select active dropdown item
This commit is contained in:
parent
ad5d7b628d
commit
df0ed2dc0c
@ -26,6 +26,9 @@ impl Gemini {
|
|||||||
// Init shared components
|
// Init shared components
|
||||||
let auth_url = auth_uri.to_string();
|
let auth_url = auth_uri.to_string();
|
||||||
|
|
||||||
|
// Set first record selected by default
|
||||||
|
let mut selected: u32 = 0;
|
||||||
|
|
||||||
// Add new identity option
|
// Add new identity option
|
||||||
widget.form.list.append(
|
widget.form.list.append(
|
||||||
Value::GENERATE_NEW_AUTH,
|
Value::GENERATE_NEW_AUTH,
|
||||||
@ -41,9 +44,12 @@ impl Gemini {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Collect additional options from database
|
// Collect additional options from database
|
||||||
|
let mut i = 1; // start from 2'th
|
||||||
match profile.identity.gemini.database.records() {
|
match profile.identity.gemini.database.records() {
|
||||||
Ok(identities) => {
|
Ok(identities) => {
|
||||||
for identity in identities {
|
for identity in identities {
|
||||||
|
i += 1;
|
||||||
|
|
||||||
// Get certificate details
|
// Get certificate details
|
||||||
let certificate = match TlsCertificate::from_pem(&identity.pem) {
|
let certificate = match TlsCertificate::from_pem(&identity.pem) {
|
||||||
Ok(certificate) => certificate,
|
Ok(certificate) => certificate,
|
||||||
@ -73,7 +79,26 @@ impl Gemini {
|
|||||||
.count(),
|
.count(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Is selected?
|
||||||
|
if profile
|
||||||
|
.identity
|
||||||
|
.gemini
|
||||||
|
.auth
|
||||||
|
.database
|
||||||
|
.records(Some(auth_url.as_str()))
|
||||||
|
.unwrap()
|
||||||
|
.iter()
|
||||||
|
.filter(|this| this.profile_identity_gemini_id == identity.id)
|
||||||
|
.count()
|
||||||
|
> 0
|
||||||
|
{
|
||||||
|
selected = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Select list item
|
||||||
|
widget.form.list.gobject.set_selected(selected);
|
||||||
}
|
}
|
||||||
Err(_) => todo!(),
|
Err(_) => todo!(),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user