Skip to content

Commit

Permalink
disconnect the dialogs from the main window, show them centered on th…
Browse files Browse the repository at this point in the history
…e screen instead
  • Loading branch information
ftl committed Dec 21, 2023
1 parent 9a2f867 commit 4d95e18
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ui/mainWindow.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (w *mainWindow) SelectOpenFile(title string, dir string, patterns ...string

log.Printf("OPEN FILE in %s", dir)

dlg.SetTransientFor(nil)
dlg.SetCurrentFolder(dir)

if len(patterns) > 0 {
Expand Down Expand Up @@ -104,6 +105,7 @@ func (w *mainWindow) SelectSaveFile(title string, dir string, filename string, p

log.Printf("SAVE FILE in %s", dir)

dlg.SetTransientFor(nil)
dlg.SetDoOverwriteConfirmation(true)
dlg.SetCurrentFolder(dir)
dlg.SetCurrentName(filename)
Expand All @@ -130,11 +132,13 @@ func (w *mainWindow) SelectSaveFile(title string, dir string, filename string, p
func (w *mainWindow) ShowInfoDialog(format string, a ...any) {
dlg := gtk.MessageDialogNew(w.window, gtk.DIALOG_MODAL, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, format, a...)
defer dlg.Destroy()
dlg.SetTransientFor(nil)
dlg.Run()
}

func (w *mainWindow) ShowErrorDialog(format string, a ...any) {
dlg := gtk.MessageDialogNew(w.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, format, a...)
defer dlg.Destroy()
dlg.SetTransientFor(nil)
dlg.Run()
}

0 comments on commit 4d95e18

Please sign in to comment.