Skip to content

Commit

Permalink
Fatal bug
Browse files Browse the repository at this point in the history
  • Loading branch information
aaravlu committed Nov 12, 2024
1 parent 4a063ba commit 6da7642
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 22 deletions.
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,3 @@ appdata_paths = [
"$APPDATA/$PUBLISHER/$PRODUCTNAME",
"$LOCALAPPDATA/$PRODUCTNAME",
]
[profile.dev]
debug = 0
41 changes: 21 additions & 20 deletions src/home/spaces_dock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,39 +189,40 @@ live_design! {
pub struct Profile {
#[deref]
view: View,
#[rust(VerificationState::Unverified)]
verification_state: VerificationState,
}

impl Widget for Profile {
fn handle_event(&mut self, cx: &mut Cx, event: &Event, scope: &mut Scope) {
if let Event::Actions(actions) = event {
for action in actions {
if let Some(VerificationStateAction::Update(state)) = action.downcast_ref() {
match state {
VerificationState::Unknown => {
self.view(id!(verification_yes)).set_visible_and_redraw(cx, false);
self.view(id!(verification_no)).set_visible_and_redraw(cx, false);
self.view(id!(verification_unk)).set_visible_and_redraw(cx, true);
}
VerificationState::Verified => {
self.view(id!(verification_yes)).set_visible_and_redraw(cx, true);
self.view(id!(verification_no)).set_visible_and_redraw(cx, false);
self.view(id!(verification_unk)).set_visible_and_redraw(cx, false);
}
VerificationState::Unverified => {
self.view(id!(verification_yes)).set_visible_and_redraw(cx, false);
self.view(id!(verification_no)).set_visible_and_redraw(cx, true);
self.view(id!(verification_unk)).set_visible_and_redraw(cx, false);
}
}
self.verification_state = *state
}
}
}
self.redraw(cx);
self.view.handle_event(cx, event, scope);
self.view.handle_event(cx, event, scope)
}

fn draw_walk(&mut self, cx: &mut Cx2d, scope: &mut Scope, walk: Walk) -> DrawStep {
self.redraw(cx);
match self.verification_state {
VerificationState::Unknown => {
self.view(id!(verification_yes)).set_visible(false);
self.view(id!(verification_no)).set_visible(false);
self.view(id!(verification_unk)).set_visible(true);
}
VerificationState::Verified => {
self.view(id!(verification_yes)).set_visible(true);
self.view(id!(verification_no)).set_visible(false);
self.view(id!(verification_unk)).set_visible(false);
}
VerificationState::Unverified => {
self.view(id!(verification_yes)).set_visible(false);
self.view(id!(verification_no)).set_visible(true);
self.view(id!(verification_unk)).set_visible(false);
}
}
self.view.draw_walk(cx, scope, walk)
}
}

0 comments on commit 6da7642

Please sign in to comment.