From c897785f00217852a29a3a91ba2eae955fb73253 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 20 Nov 2024 18:18:48 +0200 Subject: [PATCH] add guest session option, rename enum values --- .../browser/window/tab/item/identity/gemini.rs | 17 ++++++++++++----- .../tab/item/identity/gemini/widget/form.rs | 2 +- .../identity/gemini/widget/form/list/item.rs | 12 ++++++------ .../gemini/widget/form/list/item/value.rs | 4 ++-- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/src/app/browser/window/tab/item/identity/gemini.rs b/src/app/browser/window/tab/item/identity/gemini.rs index 58870721..ac2605e8 100644 --- a/src/app/browser/window/tab/item/identity/gemini.rs +++ b/src/app/browser/window/tab/item/identity/gemini.rs @@ -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()) diff --git a/src/app/browser/window/tab/item/identity/gemini/widget/form.rs b/src/app/browser/window/tab/item/identity/gemini/widget/form.rs index 5c219829..987bb903 100644 --- a/src/app/browser/window/tab/item/identity/gemini/widget/form.rs +++ b/src/app/browser/window/tab/item/identity/gemini/widget/form.rs @@ -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, }) } diff --git a/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item.rs b/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item.rs index 9cb46676..1a24c7c1 100644 --- a/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item.rs +++ b/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item.rs @@ -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), } } diff --git a/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item/value.rs b/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item/value.rs index 61ae53b6..08552ce7 100644 --- a/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item/value.rs +++ b/src/app/browser/window/tab/item/identity/gemini/widget/form/list/item/value.rs @@ -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), }