mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-09-13 07:22:16 +00:00
deactivate exit action if not active, update method names
This commit is contained in:
parent
d70c4fa963
commit
2d5a84c39c
@ -28,6 +28,8 @@ pub struct Form {
|
|||||||
pub name: Rc<Name>,
|
pub name: Rc<Name>,
|
||||||
pub save: Rc<Save>,
|
pub save: Rc<Save>,
|
||||||
pub g_box: Box,
|
pub g_box: Box,
|
||||||
|
auth_uri: Uri,
|
||||||
|
profile: Rc<Profile>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Form {
|
impl Form {
|
||||||
@ -76,6 +78,8 @@ impl Form {
|
|||||||
name,
|
name,
|
||||||
save,
|
save,
|
||||||
g_box,
|
g_box,
|
||||||
|
auth_uri,
|
||||||
|
profile,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,23 +96,34 @@ impl Form {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
// Get selected item value
|
// Get shared selected item value
|
||||||
let value = self.list.selected().value_enum();
|
let value = self.list.selected().value_enum();
|
||||||
|
|
||||||
// Toggle visibility for children components
|
// Begin children components update
|
||||||
self.name.set_visible(matches!(value, Value::GeneratePem));
|
self.name.update(matches!(value, Value::GeneratePem));
|
||||||
self.file.set_visible(matches!(value, Value::ImportPem));
|
self.file.update(matches!(value, Value::ImportPem));
|
||||||
|
|
||||||
match value {
|
match value {
|
||||||
Value::ProfileIdentityGeminiId(_) => {
|
Value::ProfileIdentityGeminiId(profile_identity_gemini_id) => {
|
||||||
self.drop.set_visible(true);
|
self.drop.update(true);
|
||||||
self.exit.set_visible(true);
|
self.exit.update(
|
||||||
self.save.set_visible(true);
|
true,
|
||||||
|
self.profile
|
||||||
|
.identity
|
||||||
|
.gemini
|
||||||
|
.auth
|
||||||
|
.memory
|
||||||
|
.match_scope(&self.auth_uri.to_string())
|
||||||
|
.is_some_and(|auth| {
|
||||||
|
auth.profile_identity_gemini_id == profile_identity_gemini_id
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
self.save.update(true);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
self.drop.set_visible(false);
|
self.drop.update(false);
|
||||||
self.exit.set_visible(false);
|
self.exit.update(false, false);
|
||||||
self.save.set_visible(false);
|
self.save.update(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ impl Drop {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn set_visible(&self, is_visible: bool) {
|
pub fn update(&self, is_visible: bool) {
|
||||||
self.button.set_visible(is_visible)
|
self.button.set_visible(is_visible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,8 @@ impl Exit {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn set_visible(&self, is_visible: bool) {
|
pub fn update(&self, is_visible: bool, is_sensitive: bool) {
|
||||||
self.button.set_visible(is_visible)
|
self.button.set_visible(is_visible);
|
||||||
|
self.button.set_sensitive(is_sensitive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ impl File {
|
|||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
/// Change visibility status
|
/// Change visibility status
|
||||||
pub fn set_visible(&self, is_visible: bool) {
|
pub fn update(&self, is_visible: bool) {
|
||||||
self.button.set_visible(is_visible);
|
self.button.set_visible(is_visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ impl Name {
|
|||||||
|
|
||||||
/// Change visibility status
|
/// Change visibility status
|
||||||
/// * grab focus on `is_visible` is `true`
|
/// * grab focus on `is_visible` is `true`
|
||||||
pub fn set_visible(&self, is_visible: bool) {
|
pub fn update(&self, is_visible: bool) {
|
||||||
self.entry.set_visible(is_visible);
|
self.entry.set_visible(is_visible);
|
||||||
if is_visible && self.entry.focus_child().is_none() {
|
if is_visible && self.entry.focus_child().is_none() {
|
||||||
self.entry.grab_focus();
|
self.entry.grab_focus();
|
||||||
|
@ -128,7 +128,7 @@ impl Save {
|
|||||||
|
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn set_visible(&self, is_visible: bool) {
|
pub fn update(&self, is_visible: bool) {
|
||||||
self.button.set_visible(is_visible)
|
self.button.set_visible(is_visible)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user