Skip to main content

Mountain/RPC/CocoonService/Workspace/
SaveAll.rs

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