From e212461dfee3a9f175ef3dc5ed619ecfc5b82549 Mon Sep 17 00:00:00 2001 From: Nathan Sobo Date: Tue, 14 Sep 2021 17:06:40 -0600 Subject: [PATCH] Authenticate when clicking on unauthenticated avatar in titlebar Co-Authored-By: Max Brunsfeld --- zed/src/workspace.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/zed/src/workspace.rs b/zed/src/workspace.rs index 1cef8caef0..bb69d18424 100644 --- a/zed/src/workspace.rs +++ b/zed/src/workspace.rs @@ -12,7 +12,7 @@ use crate::{ settings::Settings, user, worktree::{File, Worktree}, - AppState, + AppState, Authenticate, }; use anyhow::{anyhow, Result}; use gpui::{ @@ -21,7 +21,7 @@ use gpui::{ geometry::{rect::RectF, vector::vec2f}, json::to_string_pretty, keymap::Binding, - platform::WindowOptions, + platform::{CursorStyle, WindowOptions}, AnyViewHandle, AppContext, ClipboardItem, Entity, ModelHandle, MutableAppContext, PathPromptOptions, PromptLevel, RenderContext, Task, View, ViewContext, ViewHandle, WeakModelHandle, @@ -967,9 +967,14 @@ impl Workspace { .with_style(theme.workspace.titlebar.avatar) .boxed() } else { - Svg::new("icons/signed-out-12.svg") - .with_color(theme.workspace.titlebar.icon_signed_out) - .boxed() + MouseEventHandler::new::(0, cx, |_, _| { + Svg::new("icons/signed-out-12.svg") + .with_color(theme.workspace.titlebar.icon_signed_out) + .boxed() + }) + .on_click(|cx| cx.dispatch_action(Authenticate)) + .with_cursor_style(CursorStyle::PointingHand) + .boxed() }; ConstrainedBox::new(