Authenticate when clicking on unauthenticated avatar in titlebar

Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
Nathan Sobo 2021-09-14 17:06:40 -06:00
parent 0f415a594f
commit e212461dfe

View file

@ -12,7 +12,7 @@ use crate::{
settings::Settings, settings::Settings,
user, user,
worktree::{File, Worktree}, worktree::{File, Worktree},
AppState, AppState, Authenticate,
}; };
use anyhow::{anyhow, Result}; use anyhow::{anyhow, Result};
use gpui::{ use gpui::{
@ -21,7 +21,7 @@ use gpui::{
geometry::{rect::RectF, vector::vec2f}, geometry::{rect::RectF, vector::vec2f},
json::to_string_pretty, json::to_string_pretty,
keymap::Binding, keymap::Binding,
platform::WindowOptions, platform::{CursorStyle, WindowOptions},
AnyViewHandle, AppContext, ClipboardItem, Entity, ModelHandle, MutableAppContext, AnyViewHandle, AppContext, ClipboardItem, Entity, ModelHandle, MutableAppContext,
PathPromptOptions, PromptLevel, RenderContext, Task, View, ViewContext, ViewHandle, PathPromptOptions, PromptLevel, RenderContext, Task, View, ViewContext, ViewHandle,
WeakModelHandle, WeakModelHandle,
@ -967,9 +967,14 @@ impl Workspace {
.with_style(theme.workspace.titlebar.avatar) .with_style(theme.workspace.titlebar.avatar)
.boxed() .boxed()
} else { } else {
Svg::new("icons/signed-out-12.svg") MouseEventHandler::new::<Authenticate, _, _, _>(0, cx, |_, _| {
.with_color(theme.workspace.titlebar.icon_signed_out) Svg::new("icons/signed-out-12.svg")
.boxed() .with_color(theme.workspace.titlebar.icon_signed_out)
.boxed()
})
.on_click(|cx| cx.dispatch_action(Authenticate))
.with_cursor_style(CursorStyle::PointingHand)
.boxed()
}; };
ConstrainedBox::new( ConstrainedBox::new(