Add setting to disable the sign in button (#30450)

Tristan Hume and Mikayla Maki created

Designed to pair with #30444 to enable enterprises to make it harder to
sign into the collab server and perhaps accidentally end up sending code
to Zed.

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla@zed.dev>

Change summary

assets/settings/default.json               | 4 +++-
crates/title_bar/src/title_bar.rs          | 4 +++-
crates/title_bar/src/title_bar_settings.rs | 5 +++++
3 files changed, 11 insertions(+), 2 deletions(-)

Detailed changes

assets/settings/default.json 🔗

@@ -335,7 +335,9 @@
     // Whether to show onboarding banners in the titlebar.
     "show_onboarding_banner": true,
     // Whether to show user picture in the titlebar.
-    "show_user_picture": true
+    "show_user_picture": true,
+    // Whether to show the sign in button in the titlebar.
+    "show_sign_in": true
   },
   // Scrollbar related settings
   "scrollbar": {

crates/title_bar/src/title_bar.rs 🔗

@@ -237,7 +237,9 @@ impl Render for TitleBar {
                                     el.child(self.render_user_menu_button(cx))
                                 } else {
                                     el.children(self.render_connection_status(status, cx))
-                                        .child(self.render_sign_in_button(cx))
+                                        .when(TitleBarSettings::get_global(cx).show_sign_in, |el| {
+                                            el.child(self.render_sign_in_button(cx))
+                                        })
                                         .child(self.render_user_menu_button(cx))
                                 }
                             }),

crates/title_bar/src/title_bar_settings.rs 🔗

@@ -26,6 +26,10 @@ pub struct TitleBarSettings {
     ///
     /// Default: true
     pub show_project_items: bool,
+    /// Whether to show the sign in button in the title bar.
+    ///
+    /// Default: true
+    pub show_sign_in: bool,
 }
 
 impl Default for TitleBarSettings {
@@ -36,6 +40,7 @@ impl Default for TitleBarSettings {
             show_user_picture: true,
             show_branch_name: true,
             show_project_items: true,
+            show_sign_in: true,
         }
     }
 }