Fix Windows build: SystemTrayMenuItem, HashMap types, AppHandle clone
This commit is contained in:
parent
d5599f1eb6
commit
3647f19b59
|
|
@ -1,6 +1,7 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use serde_json::Value;
|
use serde_json::Value;
|
||||||
|
use tauri::{AppHandle, Manager};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
@ -25,7 +26,7 @@ pub struct Event {
|
||||||
impl EventBus {
|
impl EventBus {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
let (sender, mut receiver) = mpsc::unbounded_channel::<Event>();
|
let (sender, mut receiver) = mpsc::unbounded_channel::<Event>();
|
||||||
let subscribers = Arc::new(Mutex::new(HashMap::new()));
|
let subscribers: Arc<Mutex<HashMap<String, Vec<(SubscriptionId, EventHandler)>>>> = Arc::new(Mutex::new(HashMap::new()));
|
||||||
let subs_clone = subscribers.clone();
|
let subs_clone = subscribers.clone();
|
||||||
|
|
||||||
// Event dispatch loop
|
// Event dispatch loop
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ mod settings;
|
||||||
mod ocr;
|
mod ocr;
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use tauri::{Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowEvent};
|
use tauri::{CustomMenuItem, Manager, SystemTray, SystemTrayEvent, SystemTrayMenu, SystemTrayMenuItem, WindowEvent};
|
||||||
use tracing::info;
|
use tracing::info;
|
||||||
|
|
||||||
use crate::api::PluginAPI;
|
use crate::api::PluginAPI;
|
||||||
|
|
@ -25,12 +25,12 @@ fn main() {
|
||||||
info!("Starting EU-Utility V3");
|
info!("Starting EU-Utility V3");
|
||||||
|
|
||||||
let tray_menu = SystemTrayMenu::new()
|
let tray_menu = SystemTrayMenu::new()
|
||||||
.add_item(SystemTrayMenuItem::new("Show", "show"))
|
.add_item(CustomMenuItem::new("show", "Show"))
|
||||||
.add_native_item(SystemTrayMenuItem::Separator)
|
.add_native_item(SystemTrayMenuItem::Separator)
|
||||||
.add_item(SystemTrayMenuItem::new("Settings", "settings"))
|
.add_item(CustomMenuItem::new("settings", "Settings"))
|
||||||
.add_item(SystemTrayMenuItem::new("Plugins", "plugins"))
|
.add_item(CustomMenuItem::new("plugins", "Plugins"))
|
||||||
.add_native_item(SystemTrayMenuItem::Separator)
|
.add_native_item(SystemTrayMenuItem::Separator)
|
||||||
.add_item(SystemTrayMenuItem::new("Quit", "quit"));
|
.add_item(CustomMenuItem::new("quit", "Quit"));
|
||||||
|
|
||||||
let system_tray = SystemTray::new().with_menu(tray_menu);
|
let system_tray = SystemTray::new().with_menu(tray_menu);
|
||||||
|
|
||||||
|
|
@ -44,10 +44,10 @@ fn main() {
|
||||||
window.set_focus().unwrap();
|
window.set_focus().unwrap();
|
||||||
}
|
}
|
||||||
"settings" => {
|
"settings" => {
|
||||||
api::show_settings_window(app);
|
api::show_settings_window(app.clone());
|
||||||
}
|
}
|
||||||
"plugins" => {
|
"plugins" => {
|
||||||
api::show_plugins_window(app);
|
api::show_plugins_window(app.clone());
|
||||||
}
|
}
|
||||||
"quit" => {
|
"quit" => {
|
||||||
std::process::exit(0);
|
std::process::exit(0);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue