From 616a6e66b62de1771ebe7c36c837c367f4bf288e Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Mon, 10 Dec 2018 10:35:55 +1200 Subject: Added filters to open dialogs --- desktop/sources/scripts/lib/theme.js | 3 +-- desktop/sources/scripts/source.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/desktop/sources/scripts/lib/theme.js b/desktop/sources/scripts/lib/theme.js index 4b9e3b1..7e54f4d 100644 --- a/desktop/sources/scripts/lib/theme.js +++ b/desktop/sources/scripts/lib/theme.js @@ -83,8 +83,7 @@ function Theme (noir, pale) { } this.open = function () { - console.log('Open') - let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'] }) + let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'], filters: [{ name: 'Themes', extensions: ['svg'] }] }) if (!paths) { console.log('Nothing to load') } fs.readFile(paths[0], 'utf8', function (err, data) { if (err) throw err diff --git a/desktop/sources/scripts/source.js b/desktop/sources/scripts/source.js index b01dedd..9486b83 100644 --- a/desktop/sources/scripts/source.js +++ b/desktop/sources/scripts/source.js @@ -18,7 +18,7 @@ function Source (orca, terminal) { this.open = function () { console.log('Open') - let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'] }) + let paths = dialog.showOpenDialog(app.win, { properties: ['openFile'], filters: [{ name: 'Orca Machines', extensions: ['orca'] }] }) if (!paths) { console.log('Nothing to load') } this.path = paths[0] this.read(paths[0]) -- cgit v1.2.3