Skip to main content

Mountain/RPC/CocoonService/Workspace/
SaveAll.rs

1#![allow(non_snake_case)]
2
3//! Save every dirty editor (optionally including untitled) via
4//! `sky://editor/saveAll`.
5
6use serde_json::json;
7use tauri::Emitter;
8use tonic::{Response, Status};
9
10use crate::{
11	RPC::CocoonService::CocoonServiceImpl,
12	Vine::Generated::{SaveAllRequest, SaveAllResponse},
13	dev_log,
14};
15
16pub async fn Fn(Service:&CocoonServiceImpl, Request:SaveAllRequest) -> Result<Response<SaveAllResponse>, Status> {
17	dev_log!(
18		"cocoon",
19		"[CocoonService] save_all: includeUntitled={}",
20		Request.include_untitled
21	);
22
23	let _ = Service
24		.environment
25		.ApplicationHandle
26		.emit("sky://editor/saveAll", json!({ "includeUntitled": Request.include_untitled }));
27
28	Ok(Response::new(SaveAllResponse { success:true }))
29}