show progress for imports and deletions
This commit is contained in:
parent
38eea05789
commit
5e342b6fe5
13 changed files with 343 additions and 115 deletions
|
|
@ -85,18 +85,18 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
ipcMain.handle('wines:setDisabled', (e, id, disabled) => wines.setWineDisabled(id, disabled))
|
||||
ipcMain.handle('wines:setDisplayName', (e, id, name) => wines.setWineDisplayName(id, name))
|
||||
ipcMain.handle('wines:setDefault', (e, id) => wines.setDefaultWine(id))
|
||||
ipcMain.handle('wines:delete', (e, id) => {
|
||||
ipcMain.handle('wines:delete', async (e, id) => {
|
||||
// the build's files back the running prefix (dlls, stub exes) - deleting
|
||||
// it under a running game breaks that game
|
||||
if (library.isWineInUse(id, games.runningInfo())) {
|
||||
const apps = games.runningInfo().filter(r => r.wine === id).map(r => r.name)
|
||||
return { ok: false, error: 'inUse', apps }
|
||||
}
|
||||
return wines.deleteWine(id)
|
||||
return wines.deleteWine(id, data => sendToWindow(getWindow(), 'import:progress', data))
|
||||
})
|
||||
ipcMain.handle('wines:import', async (e, srcDir) => {
|
||||
try {
|
||||
return await wines.importWineFolder(srcDir)
|
||||
return await wines.importWineFolder(srcDir, data => sendToWindow(getWindow(), 'import:progress', data))
|
||||
} catch (err) {
|
||||
return errorResult(err)
|
||||
}
|
||||
|
|
@ -113,14 +113,14 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
}
|
||||
ipcMain.handle('prefixes:list', () => prefixes.listPrefixes())
|
||||
ipcMain.handle('prefixes:create', (e, name) => prefixes.createPrefix(name))
|
||||
ipcMain.handle('prefixes:delete', (e, name) => {
|
||||
ipcMain.handle('prefixes:delete', async (e, name) => {
|
||||
const busy = prefixInUse(name)
|
||||
if (busy) return busy
|
||||
// deleting a prefix that still has apps registered in it would orphan
|
||||
// them (they fall back to the default prefix and lose their files)
|
||||
const users = library.gamesUsingPrefix(name).map(g => g.name)
|
||||
if (users.length) return { ok: false, error: 'hasApps', apps: users }
|
||||
return prefixes.deletePrefix(name)
|
||||
return prefixes.deletePrefix(name, data => sendToWindow(getWindow(), 'import:progress', data))
|
||||
})
|
||||
ipcMain.handle('prefixes:rename', (e, oldName, newName) => prefixInUse(oldName) || prefixes.renamePrefix(oldName, newName))
|
||||
ipcMain.handle('prefixes:setDefault', (e, name) => {
|
||||
|
|
@ -144,7 +144,7 @@ function registerIpc({ getWindow, onGamesChanged }) {
|
|||
ipcMain.handle('games:reorder', (e, ids) => library.reorderGames(ids))
|
||||
ipcMain.handle('games:remove', (e, id) => {
|
||||
shortcuts.removeShortcut(id)
|
||||
return library.removeGame(id)
|
||||
return library.removeGame(id, data => sendToWindow(getWindow(), 'import:progress', data))
|
||||
})
|
||||
ipcMain.handle('games:createShortcut', (e, id) => {
|
||||
const game = library.getGame(id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue