Manage plugin enabled state
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use std::path::PathBuf;
|
||||
|
||||
use ely_domain::{PluginManifest, PluginPermission};
|
||||
use ely_domain::{PluginId, PluginManifest, PluginPermission};
|
||||
use gpui::{Context, PathPromptOptions, Window};
|
||||
|
||||
use crate::services::{
|
||||
@@ -86,6 +86,28 @@ impl ElyShell {
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
pub(super) fn set_plugin_enabled(
|
||||
&mut self,
|
||||
plugin_id: PluginId,
|
||||
enabled: bool,
|
||||
cx: &mut Context<Self>,
|
||||
) {
|
||||
let result = match &mut self.state {
|
||||
ShellState::Ready(core) => {
|
||||
let action = if enabled {
|
||||
core.enable_plugin(&plugin_id)
|
||||
} else {
|
||||
core.disable_plugin(&plugin_id)
|
||||
};
|
||||
action.map_err(|error| error.to_string())
|
||||
}
|
||||
ShellState::StartupError(message) => Err(message.clone()),
|
||||
};
|
||||
|
||||
self.plugin_install_error = result.err();
|
||||
cx.notify();
|
||||
}
|
||||
|
||||
fn handle_plugin_package_result(
|
||||
&mut self,
|
||||
result: Result<VerifiedPluginPackage, PluginPackageError>,
|
||||
|
||||
Reference in New Issue
Block a user