diff --git a/frontend/src/dialogs/input.svelte b/frontend/src/dialogs/input.svelte
new file mode 100644
index 0000000..b6f75d2
--- /dev/null
+++ b/frontend/src/dialogs/input.svelte
@@ -0,0 +1,38 @@
+
+
+
+ {#if description}
+ {description}
+ {/if}
+
+
+
+
+
+
+
+
diff --git a/frontend/src/lib/dialogs.js b/frontend/src/lib/dialogs.js
index 2d434a4..1ddf45d 100644
--- a/frontend/src/lib/dialogs.js
+++ b/frontend/src/lib/dialogs.js
@@ -1,3 +1,5 @@
+import InputDialog from '../dialogs/input.svelte';
+
function newDialog(dialogComponent, data = {}) {
const outlet = document.createElement('div');
outlet.className = 'dialogoutlet';
@@ -15,6 +17,17 @@ function newDialog(dialogComponent, data = {}) {
return instance;
}
-const dialogs = { new: newDialog };
+function enterText(title = '', description = '', value = '') {
+ const instance = newDialog(InputDialog, { title, description, value });
+
+ return new Promise(resolve => {
+ instance.$on('submit', event => {
+ instance.$close();
+ resolve(event.detail.value);
+ });
+ });
+}
+
+const dialogs = { new: newDialog, enterText };
export default dialogs;
diff --git a/frontend/wailsjs/go/ui/UI.d.ts b/frontend/wailsjs/go/ui/UI.d.ts
index 13da8e8..9a21c46 100755
--- a/frontend/wailsjs/go/ui/UI.d.ts
+++ b/frontend/wailsjs/go/ui/UI.d.ts
@@ -4,8 +4,6 @@ import {context} from '../models';
export function Beep():Promise;
-export function EnterText(arg1:string,arg2:string,arg3:string):Promise;
-
export function OpenDirectory(arg1:string):Promise;
export function Reveal(arg1:string):Promise;
diff --git a/frontend/wailsjs/go/ui/UI.js b/frontend/wailsjs/go/ui/UI.js
index ce98890..9c4e414 100755
--- a/frontend/wailsjs/go/ui/UI.js
+++ b/frontend/wailsjs/go/ui/UI.js
@@ -6,10 +6,6 @@ export function Beep() {
return window['go']['ui']['UI']['Beep']();
}
-export function EnterText(arg1, arg2, arg3) {
- return window['go']['ui']['UI']['EnterText'](arg1, arg2, arg3);
-}
-
export function OpenDirectory(arg1) {
return window['go']['ui']['UI']['OpenDirectory'](arg1);
}
diff --git a/internal/ui/dialogs.go b/internal/ui/dialogs.go
index 1845abb..b40c27c 100644
--- a/internal/ui/dialogs.go
+++ b/internal/ui/dialogs.go
@@ -15,16 +15,3 @@ func (u *UI) OpenDirectory(title string) string {
return dir
}
-
-func (u *UI) EnterText(title, info, defaultEntry string) string {
- input, err := zenity.Entry(info, zenity.Title(title), zenity.EntryText(defaultEntry), zenity.Modal())
-
- if err == zenity.ErrCanceled {
- return ""
- } else if err != nil {
- zenity.Error(err.Error(), zenity.Title("Encountered an error!"), zenity.ErrorIcon)
- return ""
- } else {
- return input
- }
-}
diff --git a/main.go b/main.go
index abe0cd5..8998ce0 100644
--- a/main.go
+++ b/main.go
@@ -7,7 +7,6 @@ import (
"github.com/garraflavatra/rolens/internal"
"github.com/garraflavatra/rolens/internal/app"
uictrl "github.com/garraflavatra/rolens/internal/ui"
- "github.com/ncruces/zenity"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
@@ -48,7 +47,11 @@ func main() {
defer func() {
if p := recover(); p != nil {
runtime.LogFatalf(ctx, "Application panicked: %v", p)
- zenity.Error("A fatal error occured.")
+ runtime.MessageDialog(ctx, runtime.MessageDialogOptions{
+ Type: runtime.ErrorDialog,
+ Title: "A fatal error occured!",
+ Message: "Please try to restart the application, or consult the logs for more details.",
+ })
}
}()