mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-28 12:04:13 +00:00
add guest session option, rename enum values
This commit is contained in:
parent
9e12cc9044
commit
c897785f00
@ -28,9 +28,16 @@ impl Gemini {
|
||||
|
||||
// Add new identity option
|
||||
widget.form.list.append(
|
||||
Value::CREATE_NEW_AUTH,
|
||||
"Create new..",
|
||||
"Auto-generated certificate",
|
||||
Value::GENERATE_NEW_AUTH,
|
||||
"Create new",
|
||||
"Generate long-term certificate",
|
||||
);
|
||||
|
||||
// Add guest option
|
||||
widget.form.list.append(
|
||||
Value::USE_GUEST_SESSION,
|
||||
"Guest session",
|
||||
"No identity for this request",
|
||||
);
|
||||
|
||||
// Collect additional options from database
|
||||
@ -78,8 +85,8 @@ impl Gemini {
|
||||
// Get record ID depending of user selection
|
||||
let profile_identity_gemini_id = match response {
|
||||
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
||||
Value::REMOVE_CURRENT_AUTH => todo!(),
|
||||
Value::CREATE_NEW_AUTH => profile
|
||||
Value::USE_GUEST_SESSION => todo!(),
|
||||
Value::GENERATE_NEW_AUTH => profile
|
||||
.identity
|
||||
.gemini
|
||||
.create(None, widget.form.name.value().as_deref())
|
||||
|
@ -36,7 +36,7 @@ impl Form {
|
||||
let name = name.clone();
|
||||
move |key| {
|
||||
name.gobject.set_visible(match key {
|
||||
Value::CREATE_NEW_AUTH => true,
|
||||
Value::GENERATE_NEW_AUTH => true,
|
||||
_ => false,
|
||||
})
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ glib::wrapper! {
|
||||
|
||||
// C-type property `value` conversion for `Item`
|
||||
// * values > 0 reserved for `profile_identity_gemini_id`
|
||||
const G_VALUE_CREATE_NEW_AUTH: i64 = 0;
|
||||
const G_VALUE_REMOVE_CURRENT_AUTH: i64 = -1;
|
||||
const G_VALUE_GENERATE_NEW_AUTH: i64 = 0;
|
||||
const G_VALUE_USE_GUEST_SESSION: i64 = -1;
|
||||
|
||||
impl Item {
|
||||
// Constructors
|
||||
@ -22,8 +22,8 @@ impl Item {
|
||||
.property(
|
||||
"value",
|
||||
match value {
|
||||
Value::CREATE_NEW_AUTH => G_VALUE_CREATE_NEW_AUTH,
|
||||
Value::REMOVE_CURRENT_AUTH => G_VALUE_REMOVE_CURRENT_AUTH,
|
||||
Value::GENERATE_NEW_AUTH => G_VALUE_GENERATE_NEW_AUTH,
|
||||
Value::USE_GUEST_SESSION => G_VALUE_USE_GUEST_SESSION,
|
||||
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
||||
},
|
||||
)
|
||||
@ -37,8 +37,8 @@ impl Item {
|
||||
/// Get `value` as enum `Value`
|
||||
pub fn value_enum(&self) -> Value {
|
||||
match self.value() {
|
||||
G_VALUE_CREATE_NEW_AUTH => Value::CREATE_NEW_AUTH,
|
||||
G_VALUE_REMOVE_CURRENT_AUTH => Value::REMOVE_CURRENT_AUTH,
|
||||
G_VALUE_GENERATE_NEW_AUTH => Value::GENERATE_NEW_AUTH,
|
||||
G_VALUE_USE_GUEST_SESSION => Value::USE_GUEST_SESSION,
|
||||
value => Value::PROFILE_IDENTITY_GEMINI_ID(value),
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#[derive(Debug)]
|
||||
pub enum Value {
|
||||
CREATE_NEW_AUTH,
|
||||
REMOVE_CURRENT_AUTH,
|
||||
GENERATE_NEW_AUTH,
|
||||
USE_GUEST_SESSION,
|
||||
PROFILE_IDENTITY_GEMINI_ID(i64),
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user