Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use IFileDialog where available. #91

Merged
merged 7 commits into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion date_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ func (dlg *calendarDialog) setup(text string, opts options) (time.Time, error) {
win.SetFocus(dlg.dateCtl)
win.ShowWindow(dlg.wnd, win.SW_NORMAL)

if opts.ctx != nil {
if opts.ctx != nil && opts.ctx.Done() != nil {
wait := make(chan struct{})
defer close(wait)
go func() {
Expand Down
2 changes: 1 addition & 1 deletion entry_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (dlg *entryDialog) setup(text string, opts options) (string, error) {
win.ShowWindow(dlg.wnd, win.SW_NORMAL)
win.SendMessage(dlg.editCtl, win.EM_SETSEL, 0, intptr(-1))

if opts.ctx != nil {
if opts.ctx != nil && opts.ctx.Done() != nil {
wait := make(chan struct{})
defer close(wait)
go func() {
Expand Down
17 changes: 8 additions & 9 deletions file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package zenity_test
import (
"context"
"errors"
"fmt"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -124,7 +123,7 @@ func TestSelectFile_script(t *testing.T) {
}

t.Run("Cancel", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, cancel."))
zenity.Info("In the file selection dialog, cancel.")
str, err := zenity.SelectFile()
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -134,7 +133,7 @@ func TestSelectFile_script(t *testing.T) {
}
})
t.Run("File", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, pick any file."))
zenity.Info("In the file selection dialog, pick any file.")
str, err := zenity.SelectFile()
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -147,7 +146,7 @@ func TestSelectFile_script(t *testing.T) {
}
})
t.Run("Directory", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, pick any directory."))
zenity.Info("In the file selection dialog, pick any directory.")
str, err := zenity.SelectFile(zenity.Directory())
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -169,7 +168,7 @@ func TestSelectFileMultiple_script(t *testing.T) {
}

t.Run("Cancel", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, cancel."))
zenity.Info("In the file selection dialog, cancel.")
lst, err := zenity.SelectFileMultiple()
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -179,7 +178,7 @@ func TestSelectFileMultiple_script(t *testing.T) {
}
})
t.Run("Files", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, pick two files."))
zenity.Info("In the file selection dialog, pick two files.")
lst, err := zenity.SelectFileMultiple()
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -194,7 +193,7 @@ func TestSelectFileMultiple_script(t *testing.T) {
}
})
t.Run("Directories", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file selection dialog, pick two directories."))
zenity.Info("In the file selection dialog, pick two directories.")
lst, err := zenity.SelectFileMultiple(zenity.Directory())
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -221,7 +220,7 @@ func TestSelectFileSave_script(t *testing.T) {
}

t.Run("Cancel", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file save dialog, cancel."))
zenity.Info("In the file save dialog, cancel.")
str, err := zenity.SelectFileSave()
if skip, err := skip(err); skip {
t.Skip("skipping:", err)
Expand All @@ -231,7 +230,7 @@ func TestSelectFileSave_script(t *testing.T) {
}
})
t.Run("Name", func(t *testing.T) {
zenity.Info(fmt.Sprintf("In the file save dialog, press OK."))
zenity.Info("In the file save dialog, press OK.")
str, err := zenity.SelectFileSave(
zenity.ConfirmOverwrite(),
zenity.Filename("Χρτο.go"),
Expand Down
Loading
Loading