mirror of
https://gitlab.com/gabmus/envision.git
synced 2025-07-13 04:21:34 +00:00
fix: add plugin to config via function instead of signal
This commit is contained in:
parent
9bdda7d63d
commit
3680e305a9
1 changed files with 20 additions and 20 deletions
|
@ -56,7 +56,6 @@ pub enum PluginStoreMsg {
|
||||||
ShowDetails(usize),
|
ShowDetails(usize),
|
||||||
ShowPluginList,
|
ShowPluginList,
|
||||||
PresentAddCustomPluginWin,
|
PresentAddCustomPluginWin,
|
||||||
AddPluginToConfig(Plugin),
|
|
||||||
AddCustomPlugin(Plugin),
|
AddCustomPlugin(Plugin),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +87,16 @@ impl PluginStore {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn add_plugin_to_config(&mut self, sender: &relm4::AsyncComponentSender<Self>, plugin: Plugin) {
|
||||||
|
self.config_plugins
|
||||||
|
.insert(plugin.appid.clone(), PluginConfig::from(&plugin));
|
||||||
|
sender
|
||||||
|
.output(PluginStoreOutMsg::UpdateConfigPlugins(
|
||||||
|
self.config_plugins.clone(),
|
||||||
|
))
|
||||||
|
.expect(SENDER_IO_ERR_MSG);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[relm4::component(pub async)]
|
#[relm4::component(pub async)]
|
||||||
|
@ -226,18 +235,9 @@ impl AsyncComponent for PluginStore {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.input(Self::Input::AddPluginToConfig(plugin));
|
self.add_plugin_to_config(&sender, plugin);
|
||||||
sender.input(Self::Input::Refresh);
|
sender.input(Self::Input::Refresh);
|
||||||
}
|
}
|
||||||
Self::Input::AddPluginToConfig(plugin) => {
|
|
||||||
self.config_plugins
|
|
||||||
.insert(plugin.appid.clone(), PluginConfig::from(&plugin));
|
|
||||||
sender
|
|
||||||
.output(Self::Output::UpdateConfigPlugins(
|
|
||||||
self.config_plugins.clone(),
|
|
||||||
))
|
|
||||||
.expect(SENDER_IO_ERR_MSG);
|
|
||||||
}
|
|
||||||
Self::Input::PresentAddCustomPluginWin => {
|
Self::Input::PresentAddCustomPluginWin => {
|
||||||
let add_win = AddCustomPluginWin::builder()
|
let add_win = AddCustomPluginWin::builder()
|
||||||
.launch(AddCustomPluginWinInit {
|
.launch(AddCustomPluginWinInit {
|
||||||
|
@ -351,19 +351,19 @@ impl AsyncComponent for PluginStore {
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sender.input(Self::Input::AddPluginToConfig(plugin.clone()));
|
self.add_plugin_to_config(&sender, plugin.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
alert(
|
alert(
|
||||||
"Download failed",
|
"Download failed",
|
||||||
Some(&format!(
|
Some(&format!(
|
||||||
"Downloading {} {} failed:\n\nNo executable url provided for this plugin, this is likely a bug!",
|
"Downloading {} {} failed:\n\nNo executable url provided for this plugin, this is likely a bug!",
|
||||||
plugin.name,
|
plugin.name,
|
||||||
plugin.version.as_ref().unwrap_or(&"(no version)".to_string()))
|
plugin.version.as_ref().unwrap_or(&"(no version)".to_string()))
|
||||||
),
|
),
|
||||||
Some(&self.win.as_ref().unwrap().clone().upcast::<gtk::Window>())
|
Some(&self.win.as_ref().unwrap().clone().upcast::<gtk::Window>())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
self.refresh_plugin_rows();
|
self.refresh_plugin_rows();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue