title_bar: Fix the order of the collab buttons (#25775)

Devzeth and Marshall Bowers created

My previous #24761 and #25192 PR's changed the order of the buttons in
the title_bar for collab, the logic is kept the same but the order is
now as it was previously.

Release Notes:

- N/A

Co-authored-by: Marshall Bowers <git@maxdeviant.com>

Change summary

crates/title_bar/src/collab.rs | 104 ++++++++++++++++++------------------
1 file changed, 52 insertions(+), 52 deletions(-)

Detailed changes

crates/title_bar/src/collab.rs 🔗

@@ -350,6 +350,44 @@ impl TitleBar {
                 .into_any_element(),
         );
 
+        if can_use_microphone {
+            children.push(
+                IconButton::new(
+                    "mute-microphone",
+                    if is_muted {
+                        ui::IconName::MicMute
+                    } else {
+                        ui::IconName::Mic
+                    },
+                )
+                .tooltip(move |window, cx| {
+                    if is_muted {
+                        if is_deafened {
+                            Tooltip::with_meta(
+                                "Unmute Microphone",
+                                None,
+                                "Audio will be unmuted",
+                                window,
+                                cx,
+                            )
+                        } else {
+                            Tooltip::simple("Unmute Microphone", cx)
+                        }
+                    } else {
+                        Tooltip::simple("Mute Microphone", cx)
+                    }
+                })
+                .style(ButtonStyle::Subtle)
+                .icon_size(IconSize::Small)
+                .toggle_state(is_muted)
+                .selected_style(ButtonStyle::Tinted(TintColor::Error))
+                .on_click(move |_, _window, cx| {
+                    toggle_mute(&Default::default(), cx);
+                })
+                .into_any_element(),
+            );
+        }
+
         children.push(
             IconButton::new(
                 "mute-sound",
@@ -386,61 +424,23 @@ impl TitleBar {
             .into_any_element(),
         );
 
-        if can_use_microphone {
+        if can_use_microphone && screen_sharing_supported {
             children.push(
-                IconButton::new(
-                    "mute-microphone",
-                    if is_muted {
-                        ui::IconName::MicMute
+                IconButton::new("screen-share", ui::IconName::Screen)
+                    .style(ButtonStyle::Subtle)
+                    .icon_size(IconSize::Small)
+                    .toggle_state(is_screen_sharing)
+                    .selected_style(ButtonStyle::Tinted(TintColor::Accent))
+                    .tooltip(Tooltip::text(if is_screen_sharing {
+                        "Stop Sharing Screen"
                     } else {
-                        ui::IconName::Mic
-                    },
-                )
-                .tooltip(move |window, cx| {
-                    if is_muted {
-                        if is_deafened {
-                            Tooltip::with_meta(
-                                "Unmute Microphone",
-                                None,
-                                "Audio will be unmuted",
-                                window,
-                                cx,
-                            )
-                        } else {
-                            Tooltip::simple("Unmute Microphone", cx)
-                        }
-                    } else {
-                        Tooltip::simple("Mute Microphone", cx)
-                    }
-                })
-                .style(ButtonStyle::Subtle)
-                .icon_size(IconSize::Small)
-                .toggle_state(is_muted)
-                .selected_style(ButtonStyle::Tinted(TintColor::Error))
-                .on_click(move |_, _window, cx| {
-                    toggle_mute(&Default::default(), cx);
-                })
-                .into_any_element(),
+                        "Share Screen"
+                    }))
+                    .on_click(move |_, window, cx| {
+                        toggle_screen_sharing(&Default::default(), window, cx)
+                    })
+                    .into_any_element(),
             );
-
-            if screen_sharing_supported {
-                children.push(
-                    IconButton::new("screen-share", ui::IconName::Screen)
-                        .style(ButtonStyle::Subtle)
-                        .icon_size(IconSize::Small)
-                        .toggle_state(is_screen_sharing)
-                        .selected_style(ButtonStyle::Tinted(TintColor::Accent))
-                        .tooltip(Tooltip::text(if is_screen_sharing {
-                            "Stop Sharing Screen"
-                        } else {
-                            "Share Screen"
-                        }))
-                        .on_click(move |_, window, cx| {
-                            toggle_screen_sharing(&Default::default(), window, cx)
-                        })
-                        .into_any_element(),
-                );
-            }
         }
 
         children.push(div().pr_2().into_any_element());