mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-01-30 13: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
|
// Add new identity option
|
||||||
widget.form.list.append(
|
widget.form.list.append(
|
||||||
Value::CREATE_NEW_AUTH,
|
Value::GENERATE_NEW_AUTH,
|
||||||
"Create new..",
|
"Create new",
|
||||||
"Auto-generated certificate",
|
"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
|
// Collect additional options from database
|
||||||
@ -78,8 +85,8 @@ impl Gemini {
|
|||||||
// Get record ID depending of user selection
|
// Get record ID depending of user selection
|
||||||
let profile_identity_gemini_id = match response {
|
let profile_identity_gemini_id = match response {
|
||||||
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
||||||
Value::REMOVE_CURRENT_AUTH => todo!(),
|
Value::USE_GUEST_SESSION => todo!(),
|
||||||
Value::CREATE_NEW_AUTH => profile
|
Value::GENERATE_NEW_AUTH => profile
|
||||||
.identity
|
.identity
|
||||||
.gemini
|
.gemini
|
||||||
.create(None, widget.form.name.value().as_deref())
|
.create(None, widget.form.name.value().as_deref())
|
||||||
|
@ -36,7 +36,7 @@ impl Form {
|
|||||||
let name = name.clone();
|
let name = name.clone();
|
||||||
move |key| {
|
move |key| {
|
||||||
name.gobject.set_visible(match key {
|
name.gobject.set_visible(match key {
|
||||||
Value::CREATE_NEW_AUTH => true,
|
Value::GENERATE_NEW_AUTH => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -10,8 +10,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_CREATE_NEW_AUTH: i64 = 0;
|
const G_VALUE_GENERATE_NEW_AUTH: i64 = 0;
|
||||||
const G_VALUE_REMOVE_CURRENT_AUTH: i64 = -1;
|
const G_VALUE_USE_GUEST_SESSION: i64 = -1;
|
||||||
|
|
||||||
impl Item {
|
impl Item {
|
||||||
// Constructors
|
// Constructors
|
||||||
@ -22,8 +22,8 @@ impl Item {
|
|||||||
.property(
|
.property(
|
||||||
"value",
|
"value",
|
||||||
match value {
|
match value {
|
||||||
Value::CREATE_NEW_AUTH => G_VALUE_CREATE_NEW_AUTH,
|
Value::GENERATE_NEW_AUTH => G_VALUE_GENERATE_NEW_AUTH,
|
||||||
Value::REMOVE_CURRENT_AUTH => G_VALUE_REMOVE_CURRENT_AUTH,
|
Value::USE_GUEST_SESSION => G_VALUE_USE_GUEST_SESSION,
|
||||||
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
Value::PROFILE_IDENTITY_GEMINI_ID(value) => value,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@ -37,8 +37,8 @@ impl Item {
|
|||||||
/// Get `value` as enum `Value`
|
/// Get `value` as enum `Value`
|
||||||
pub fn value_enum(&self) -> Value {
|
pub fn value_enum(&self) -> Value {
|
||||||
match self.value() {
|
match self.value() {
|
||||||
G_VALUE_CREATE_NEW_AUTH => Value::CREATE_NEW_AUTH,
|
G_VALUE_GENERATE_NEW_AUTH => Value::GENERATE_NEW_AUTH,
|
||||||
G_VALUE_REMOVE_CURRENT_AUTH => Value::REMOVE_CURRENT_AUTH,
|
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,6 @@
|
|||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Value {
|
pub enum Value {
|
||||||
CREATE_NEW_AUTH,
|
GENERATE_NEW_AUTH,
|
||||||
REMOVE_CURRENT_AUTH,
|
USE_GUEST_SESSION,
|
||||||
PROFILE_IDENTITY_GEMINI_ID(i64),
|
PROFILE_IDENTITY_GEMINI_ID(i64),
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user