Skip to main content

Mountain/RPC/CocoonService/Workspace/
SaveAll.rs

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