mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-15 17:20:08 +00:00
add import identity option
This commit is contained in:
parent
896fdc6a1a
commit
83d474a192
@ -43,8 +43,15 @@ impl Gemini {
|
|||||||
"Generate long-term certificate",
|
"Generate long-term certificate",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Add import existing identity option
|
||||||
|
widget.form.list.append(
|
||||||
|
Value::IMPORT_PEM,
|
||||||
|
"Import identity",
|
||||||
|
"Use existing certificate",
|
||||||
|
);
|
||||||
|
|
||||||
// Collect additional options from database
|
// Collect additional options from database
|
||||||
let mut i = 1; // start from 2'th
|
let mut i = 2; // start from 3'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 {
|
||||||
@ -118,6 +125,7 @@ impl Gemini {
|
|||||||
.create(None, &widget.form.name.value().unwrap())
|
.create(None, &widget.form.name.value().unwrap())
|
||||||
.unwrap(), // @TODO handle result,
|
.unwrap(), // @TODO handle result,
|
||||||
),
|
),
|
||||||
|
Value::IMPORT_PEM => Some(0), // @TODO
|
||||||
};
|
};
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
|
@ -11,7 +11,8 @@ glib::wrapper! {
|
|||||||
// C-type property `value` conversion for `Item`
|
// C-type property `value` conversion for `Item`
|
||||||
// * values > 0 reserved for `profile_identity_gemini_id`
|
// * values > 0 reserved for `profile_identity_gemini_id`
|
||||||
const G_VALUE_GENERATE_NEW_AUTH: i64 = 0;
|
const G_VALUE_GENERATE_NEW_AUTH: i64 = 0;
|
||||||
const G_VALUE_USE_GUEST_SESSION: i64 = -1;
|
const G_VALUE_IMPORT_PEM: i64 = -1;
|
||||||
|
const G_VALUE_USE_GUEST_SESSION: i64 = -2;
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -23,6 +24,7 @@ impl Item {
|
|||||||
"value",
|
"value",
|
||||||
match value {
|
match value {
|
||||||
Value::GENERATE_NEW_AUTH => G_VALUE_GENERATE_NEW_AUTH,
|
Value::GENERATE_NEW_AUTH => G_VALUE_GENERATE_NEW_AUTH,
|
||||||
|
Value::IMPORT_PEM => G_VALUE_IMPORT_PEM,
|
||||||
Value::USE_GUEST_SESSION => G_VALUE_USE_GUEST_SESSION,
|
Value::USE_GUEST_SESSION => G_VALUE_USE_GUEST_SESSION,
|
||||||
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
||||||
},
|
},
|
||||||
@ -38,6 +40,7 @@ impl Item {
|
|||||||
pub fn value_enum(&self) -> Value {
|
pub fn value_enum(&self) -> Value {
|
||||||
match self.value() {
|
match self.value() {
|
||||||
G_VALUE_GENERATE_NEW_AUTH => Value::GENERATE_NEW_AUTH,
|
G_VALUE_GENERATE_NEW_AUTH => Value::GENERATE_NEW_AUTH,
|
||||||
|
G_VALUE_IMPORT_PEM => Value::IMPORT_PEM,
|
||||||
G_VALUE_USE_GUEST_SESSION => Value::USE_GUEST_SESSION,
|
G_VALUE_USE_GUEST_SESSION => Value::USE_GUEST_SESSION,
|
||||||
value => Value::PROFILE_IDENTITY_GEMINI_ID(value),
|
value => Value::PROFILE_IDENTITY_GEMINI_ID(value),
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Value {
|
pub enum Value {
|
||||||
GENERATE_NEW_AUTH,
|
GENERATE_NEW_AUTH,
|
||||||
USE_GUEST_SESSION,
|
IMPORT_PEM,
|
||||||
PROFILE_IDENTITY_GEMINI_ID(i64),
|
PROFILE_IDENTITY_GEMINI_ID(i64),
|
||||||
|
USE_GUEST_SESSION,
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user