mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 09:05:27 +00:00
draft new certificate dialog features
This commit is contained in:
parent
82f5cdc5b4
commit
35ccbd8714
5 changed files with 71 additions and 12 deletions
|
|
@ -57,9 +57,21 @@ impl Gemini {
|
|||
}
|
||||
|
||||
// Init events
|
||||
widget.on_apply(move |response| match response {
|
||||
// Apply selected identity for `auth_uri`
|
||||
Some(profile_identity_gemini_id) => {
|
||||
widget.on_apply({
|
||||
let widget = widget.clone();
|
||||
move |response| {
|
||||
let profile_identity_gemini_id = match response {
|
||||
// Use selected identity
|
||||
Some(id) => id,
|
||||
// Create new identity, get last insert ID
|
||||
None => profile
|
||||
.identity
|
||||
.gemini
|
||||
.create(None, widget.form.name.value().as_deref())
|
||||
.unwrap(), // @TODO
|
||||
};
|
||||
|
||||
// Apply identity for given `auth_uri`
|
||||
profile
|
||||
.identity
|
||||
.gemini
|
||||
|
|
@ -67,8 +79,6 @@ impl Gemini {
|
|||
.apply(profile_identity_gemini_id, auth_uri.to_string().as_str())
|
||||
.unwrap(); //@TODO handle errors
|
||||
}
|
||||
// Create new certificate, then apply it to the new identity for `auth_uri`
|
||||
None => {}
|
||||
});
|
||||
|
||||
// Return activated `Self`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ use std::rc::Rc;
|
|||
pub struct Form {
|
||||
pub gobject: Box,
|
||||
pub list: Rc<List>,
|
||||
// pub name: Rc<Name>,
|
||||
pub name: Rc<Name>,
|
||||
}
|
||||
|
||||
impl Form {
|
||||
|
|
@ -32,13 +32,16 @@ impl Form {
|
|||
gobject.append(&name.gobject);
|
||||
|
||||
// Connect events
|
||||
list.on_select(move |key| name.gobject.set_visible(key.is_none()));
|
||||
list.on_select({
|
||||
let name = name.clone();
|
||||
move |key| name.gobject.set_visible(key.is_none())
|
||||
});
|
||||
|
||||
// Return activated `Self`
|
||||
Self {
|
||||
gobject,
|
||||
list,
|
||||
// name,
|
||||
name,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use gtk::Entry;
|
||||
use gtk::{glib::GString, prelude::EditableExt, Entry};
|
||||
|
||||
const PLACEHOLDER_TEXT: &str = "Identity name (optional)";
|
||||
const MARGIN: i32 = 8;
|
||||
|
|
@ -20,4 +20,15 @@ impl Name {
|
|||
.build(),
|
||||
}
|
||||
}
|
||||
|
||||
// Getters
|
||||
|
||||
pub fn value(&self) -> Option<GString> {
|
||||
let text = self.gobject.text();
|
||||
if text.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue