mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-11 21:13:02 +00:00
Add application menu item for checking for updates
This commit is contained in:
parent
9c469f2fdb
commit
fb2caf3c58
3 changed files with 13 additions and 0 deletions
|
@ -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| {
|
||||
|
|
Loading…
Reference in a new issue