Change summary
crates/auto_update/src/auto_update.rs | 6 ++++++
crates/zed/src/menus.rs | 5 +++++
crates/zed/src/zed.rs | 2 ++
3 files changed, 13 insertions(+)
Detailed changes
@@ -70,6 +70,12 @@ pub fn init(http_client: Arc<dyn HttpClient>, server_url: String, cx: &mut Mutab
}
}
+pub fn check(cx: &mut MutableAppContext) {
+ if let Some(updater) = AutoUpdater::get(cx) {
+ updater.update(cx, |updater, cx| updater.poll(cx));
+ }
+}
+
impl AutoUpdater {
fn get(cx: &mut MutableAppContext) -> Option<ModelHandle<Self>> {
cx.default_global::<Option<ModelHandle<Self>>>().clone()
@@ -13,6 +13,11 @@ pub fn menus(state: &Arc<AppState>) -> Vec<Menu<'static>> {
keystroke: None,
action: Box::new(super::About),
},
+ MenuItem::Action {
+ name: "Check for Updates",
+ keystroke: None,
+ action: Box::new(super::CheckForUpdates),
+ },
MenuItem::Separator,
MenuItem::Action {
name: "Quit",
@@ -31,6 +31,7 @@ action!(About);
action!(Quit);
action!(OpenSettings);
action!(AdjustBufferFontSize, f32);
+action!(CheckForUpdates);
const MIN_FONT_SIZE: f32 = 6.0;
@@ -43,6 +44,7 @@ lazy_static! {
pub fn init(app_state: &Arc<AppState>, cx: &mut gpui::MutableAppContext) {
cx.add_global_action(quit);
+ cx.add_global_action(|_: &CheckForUpdates, cx| auto_update::check(cx));
cx.add_global_action({
move |action: &AdjustBufferFontSize, cx| {
cx.update_global::<Settings, _, _>(|settings, cx| {