summaryrefslogtreecommitdiff
path: root/vendor/0xacab.org
diff options
context:
space:
mode:
authorKali Kaneko (leap communications) <kali@leap.se>2019-08-08 00:19:33 +0200
committerKali Kaneko (leap communications) <kali@leap.se>2019-08-08 00:19:33 +0200
commitfde18e485ff7cbc7b2e33dade8e81136f06a5b60 (patch)
tree79a6dbd13e7e4a46e708a70104c548f403b477ae /vendor/0xacab.org
parent93e1de570f47b095905835735dbd67479aa0c2de (diff)
[pkg] remove vendor
Diffstat (limited to 'vendor/0xacab.org')
-rw-r--r--vendor/0xacab.org/leap/go-dialog/LICENSE15
-rw-r--r--vendor/0xacab.org/leap/go-dialog/README.md29
-rw-r--r--vendor/0xacab.org/leap/go-dialog/dlgs.go145
-rw-r--r--vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go58
-rw-r--r--vendor/0xacab.org/leap/go-dialog/dlgs_linux.go122
-rw-r--r--vendor/0xacab.org/leap/go-dialog/dlgs_windows.go141
-rw-r--r--vendor/0xacab.org/leap/go-dialog/util.go10
7 files changed, 0 insertions, 520 deletions
diff --git a/vendor/0xacab.org/leap/go-dialog/LICENSE b/vendor/0xacab.org/leap/go-dialog/LICENSE
deleted file mode 100644
index 75bff9f..0000000
--- a/vendor/0xacab.org/leap/go-dialog/LICENSE
+++ /dev/null
@@ -1,15 +0,0 @@
-ISC License
-
-Copyright (c) 2018, the dialog authors.
-
-Permission to use, copy, modify, and/or distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies.
-
-THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. \ No newline at end of file
diff --git a/vendor/0xacab.org/leap/go-dialog/README.md b/vendor/0xacab.org/leap/go-dialog/README.md
deleted file mode 100644
index afedf80..0000000
--- a/vendor/0xacab.org/leap/go-dialog/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-# dialog
-Simple cross-platform dialog API for go-lang
-
-# examples
- ok := dialog.Message("%s", "Do you want to continue?").Title("Are you sure?").YesNo()
-
-Creates a dialog box titled "Are you sure?", containing the message "Do you want to continue?",
-a "Yes" button and a "No" button. Returns true iff the dialog could be displayed and the user
-pressed the "Yes" button.
-
- filename, err := dialog.File().Filter("Mp3 audio file", "mp3").Load()
-
-Creates a file selection dialog allowing the user to select a .mp3 file. The absolute path of
-the file is returned, unless an error is encountered or the user cancels/closes the dialog.
-In the latter case, `filename` will be the empty string and `err` will equal `dialog.Cancelled`.
-
- filename, err := dialog.File().Filter("XML files", "xml").Title("Export to XML").Save()
-
-Asks the user for a filename to write data into. If the user selects a file which already exists,
-an additional dialog is spawned to confirm they want to overwrite the existing file.
-
- directory, err := dialog.Directory().Title("Load images").Browse()
-
-Asks the user for a directory.
-
-# platform details
-* OSX: uses Cocoa's NSAlert/NSSavePanel/NSOpenPanel clasess
-* Win32: uses MessageBox/GetOpenFileName/GetSaveFileName (via package github.com/AllenDang/w32)
-* Linux: uses Gtk's MessageDialog/FileChooserDialog (via package github.com/mattn/gtk)
diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs.go b/vendor/0xacab.org/leap/go-dialog/dlgs.go
deleted file mode 100644
index 602d4e3..0000000
--- a/vendor/0xacab.org/leap/go-dialog/dlgs.go
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Package dialog provides a simple cross-platform common dialog API.
-Eg. to prompt the user with a yes/no dialog:
-
- if dialog.MsgDlg("%s", "Do you want to continue?").YesNo() {
- // user pressed Yes
- }
-
-The general usage pattern is to call one of the toplevel *Dlg functions
-which return a *Builder structure. From here you can optionally call
-configuration functions (eg. Title) to customise the dialog, before
-using a launcher function to run the dialog.
-*/
-package dialog
-
-import (
- "errors"
- "fmt"
-)
-
-/* Cancelled is an error returned when a user cancels/closes a dialog. */
-var Cancelled = errors.New("Cancelled")
-
-type Dlg struct {
- Title string
-}
-
-type MsgBuilder struct {
- Dlg
- Msg string
- IconPath string
-}
-
-/* Message initialises a MsgBuilder with the provided message */
-func Message(format string, args ...interface{}) *MsgBuilder {
- return &MsgBuilder{Msg: fmt.Sprintf(format, args...)}
-}
-
-/* Title specifies what the title of the message dialog will be */
-func (b *MsgBuilder) Title(title string) *MsgBuilder {
- b.Dlg.Title = title
- return b
-}
-
-func (b *MsgBuilder) Icon(filename string) *MsgBuilder {
- b.IconPath = filename
- return b
-}
-
-/* YesNo spawns the message dialog with two buttons, "Yes" and "No".
-Returns true iff the user selected "Yes". */
-func (b *MsgBuilder) YesNo() bool {
- return b.yesNo()
-}
-
-/* Info spawns the message dialog with an information icon and single button, "Ok". */
-func (b *MsgBuilder) Info() {
- b.info()
-}
-
-/* Error spawns the message dialog with an error icon and single button, "Ok". */
-func (b *MsgBuilder) Error() {
- b.error()
-}
-
-/* FileFilter represents a category of files (eg. audio files, spreadsheets). */
-type FileFilter struct {
- Desc string
- Extensions []string
-}
-
-type FileBuilder struct {
- Dlg
- StartDir string
- Filters []FileFilter
-}
-
-/* File initialises a FileBuilder using the default configuration. */
-func File() *FileBuilder {
- return &FileBuilder{}
-}
-
-/* Title specifies the title to be used for the dialog. */
-func (b *FileBuilder) Title(title string) *FileBuilder {
- b.Dlg.Title = title
- return b
-}
-
-/* Filter adds a category of files to the types allowed by the dialog. Multiple
-calls to Filter are cumulative - any of the provided categories will be allowed.
-By default all files can be selected.
-
-The special extension '*' allows all files to be selected when the Filter is active. */
-func (b *FileBuilder) Filter(desc string, extensions ...string) *FileBuilder {
- filt := FileFilter{desc, extensions}
- if len(filt.Extensions) == 0 {
- filt.Extensions = append(filt.Extensions, "*")
- }
- b.Filters = append(b.Filters, filt)
- return b
-}
-
-/* SetStartDir specifies the initial directory of the dialog. */
-func (b *FileBuilder) SetStartDir(startDir string) *FileBuilder {
- b.StartDir = startDir
- return b
-}
-
-/* Load spawns the file selection dialog using the configured settings,
-asking the user to select a single file. Returns Cancelled as the error
-if the user cancels or closes the dialog. */
-func (b *FileBuilder) Load() (string, error) {
- return b.load()
-}
-
-/* Save spawns the file selection dialog using the configured settings,
-asking the user for a filename to save as. If the chosen file exists, the
-user is prompted whether they want to overwrite the file. Returns
-Cancelled as the error if the user cancels/closes the dialog, or selects
-not to overwrite the file. */
-func (b *FileBuilder) Save() (string, error) {
- return b.save()
-}
-
-type DirectoryBuilder struct {
- Dlg
- StartDir string
-}
-
-/* Directory initialises a DirectoryBuilder using the default configuration. */
-func Directory() *DirectoryBuilder {
- return &DirectoryBuilder{}
-}
-
-/* Browse spawns the directory selection dialog using the configured settings,
-asking the user to select a single folder. Returns Cancelled as the error
-if the user cancels or closes the dialog. */
-func (b *DirectoryBuilder) Browse() (string, error) {
- return b.browse()
-}
-
-/* Title specifies the title to be used for the dialog. */
-func (b *DirectoryBuilder) Title(title string) *DirectoryBuilder {
- b.Dlg.Title = title
- return b
-}
diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go b/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go
deleted file mode 100644
index ae28560..0000000
--- a/vendor/0xacab.org/leap/go-dialog/dlgs_darwin.go
+++ /dev/null
@@ -1,58 +0,0 @@
-package dialog
-
-import (
- "github.com/sqweek/dialog/cocoa"
-)
-
-func (b *MsgBuilder) yesNo() bool {
- return cocoa.YesNoDlg(b.Msg, b.Dlg.Title)
-}
-
-func (b *MsgBuilder) info() {
- cocoa.InfoDlg(b.Msg, b.Dlg.Title)
-}
-
-func (b *MsgBuilder) error() {
- cocoa.ErrorDlg(b.Msg, b.Dlg.Title)
-}
-
-func (b *FileBuilder) load() (string, error) {
- return b.run(false)
-}
-
-func (b *FileBuilder) save() (string, error) {
- return b.run(true)
-}
-
-func (b *FileBuilder) run(save bool) (string, error) {
- star := false
- var exts []string
- for _, filt := range b.Filters {
- for _, ext := range filt.Extensions {
- if ext == "*" {
- star = true
- } else {
- exts = append(exts, ext)
- }
- }
- }
- if star && save {
- /* OSX doesn't allow the user to switch visible file types/extensions. Also
- ** NSSavePanel's allowsOtherFileTypes property has no effect for an open
- ** dialog, so if "*" is a possible extension we must always show all files. */
- exts = nil
- }
- f, err := cocoa.FileDlg(save, b.Dlg.Title, exts, star)
- if f == "" && err == nil {
- return "", Cancelled
- }
- return f, err
-}
-
-func (b *DirectoryBuilder) browse() (string, error) {
- f, err := cocoa.DirDlg(b.Dlg.Title);
- if f == "" && err == nil {
- return "", Cancelled
- }
- return f, err
-}
diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go b/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go
deleted file mode 100644
index ea8ac3d..0000000
--- a/vendor/0xacab.org/leap/go-dialog/dlgs_linux.go
+++ /dev/null
@@ -1,122 +0,0 @@
-package dialog
-
-import (
- "os"
- "path/filepath"
-
- "github.com/gotk3/gotk3/gdk"
- "github.com/gotk3/gotk3/glib"
- "github.com/gotk3/gotk3/gtk"
-)
-
-func closeDialog(dlg *gtk.Dialog) {
- dlg.Destroy()
-}
-
-func (b *MsgBuilder) yesNo() bool {
- ch := make(chan bool)
- _, err := glib.IdleAdd(b._yesNo, ch)
- if err != nil {
- return false
- }
- return <-ch
-}
-
-func (b *MsgBuilder) _yesNo(ch chan bool) bool {
- dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, "%s", b.Msg)
- dlg.SetTitle(firstOf(b.Dlg.Title, "Confirm?"))
- b.setIcon(dlg)
- defer closeDialog(&dlg.Dialog)
- ch <- dlg.Run() == gtk.RESPONSE_YES
- return false
-}
-
-func (b *MsgBuilder) info() {
- ch := make(chan bool)
- glib.IdleAdd(b._info, ch)
- <-ch
-}
-
-func (b *MsgBuilder) _info(ch chan bool) {
- dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_INFO, gtk.BUTTONS_OK, "%s", b.Msg)
- dlg.SetTitle(firstOf(b.Dlg.Title, "Information"))
- b.setIcon(dlg)
- defer closeDialog(&dlg.Dialog)
- dlg.Run()
- ch <- true
-}
-
-func (b *MsgBuilder) error() {
- ch := make(chan bool)
- glib.IdleAdd(b._info, ch)
- <-ch
-}
-
-func (b *MsgBuilder) _error() {
- dlg := gtk.MessageDialogNew(nil, 0, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, "%s", b.Msg)
- dlg.SetTitle(firstOf(b.Dlg.Title, "Error"))
- b.setIcon(dlg)
- defer closeDialog(&dlg.Dialog)
- dlg.Run()
-}
-
-func (b *MsgBuilder) setIcon(dlg *gtk.MessageDialog) {
- if b.IconPath == "" {
- return
- }
-
- pixbuf, err := gdk.PixbufNewFromFile(b.IconPath)
- if err != nil {
- return
- }
- dlg.SetIcon(pixbuf)
-}
-
-func (b *FileBuilder) load() (string, error) {
- return chooseFile("Load", gtk.FILE_CHOOSER_ACTION_OPEN, b)
-}
-
-func (b *FileBuilder) save() (string, error) {
- f, err := chooseFile("Save", gtk.FILE_CHOOSER_ACTION_SAVE, b)
- if err != nil {
- return "", err
- }
- _, err = os.Stat(f)
- if !os.IsNotExist(err) && !Message("%s already exists, overwrite?", filepath.Base(f)).yesNo() {
- return "", Cancelled
- }
- return f, nil
-}
-
-func chooseFile(title string, action gtk.FileChooserAction, b *FileBuilder) (string, error) {
- dlg, err := gtk.FileChooserDialogNewWith2Buttons(firstOf(b.Dlg.Title, title), nil, action, "Ok", gtk.RESPONSE_ACCEPT, "Cancel", gtk.RESPONSE_CANCEL)
- if err != nil {
- return "", err
- }
-
- for _, filt := range b.Filters {
- filter, err := gtk.FileFilterNew()
- if err != nil {
- return "", err
- }
-
- filter.SetName(filt.Desc)
- for _, ext := range filt.Extensions {
- filter.AddPattern("*." + ext)
- }
- dlg.AddFilter(filter)
- }
- if b.StartDir != "" {
- dlg.SetCurrentFolder(b.StartDir)
- }
- r := dlg.Run()
- defer closeDialog(&dlg.Dialog)
- if r == gtk.RESPONSE_ACCEPT {
- return dlg.GetFilename(), nil
- }
- return "", Cancelled
-}
-
-func (b *DirectoryBuilder) browse() (string, error) {
- return chooseFile("Open Directory", gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, &FileBuilder{Dlg: b.Dlg})
-}
diff --git a/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go b/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go
deleted file mode 100644
index aca8e2c..0000000
--- a/vendor/0xacab.org/leap/go-dialog/dlgs_windows.go
+++ /dev/null
@@ -1,141 +0,0 @@
-package dialog
-
-import (
- "fmt"
- "reflect"
- "syscall"
- "unicode/utf16"
- "unsafe"
-
- "github.com/AllenDang/w32"
-)
-
-type WinDlgError int
-
-func (e WinDlgError) Error() string {
- return fmt.Sprintf("CommDlgExtendedError: %#x", e)
-}
-
-func err() error {
- e := w32.CommDlgExtendedError()
- if e == 0 {
- return Cancelled
- }
- return WinDlgError(e)
-}
-
-func (b *MsgBuilder) yesNo() bool {
- r := w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Confirm?"), w32.MB_YESNO)
- return r == w32.IDYES
-}
-
-func (b *MsgBuilder) info() {
- w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Information"), w32.MB_OK|w32.MB_ICONINFORMATION)
-}
-
-func (b *MsgBuilder) error() {
- w32.MessageBox(w32.HWND(0), b.Msg, firstOf(b.Dlg.Title, "Error"), w32.MB_OK|w32.MB_ICONERROR)
-}
-
-type filedlg struct {
- buf []uint16
- filters []uint16
- opf *w32.OPENFILENAME
-}
-
-func (d filedlg) Filename() string {
- i := 0
- for i < len(d.buf) && d.buf[i] != 0 {
- i++
- }
- return string(utf16.Decode(d.buf[:i]))
-}
-
-func (b *FileBuilder) load() (string, error) {
- d := openfile(w32.OFN_FILEMUSTEXIST, b)
- if w32.GetOpenFileName(d.opf) {
- return d.Filename(), nil
- }
- return "", err()
-}
-
-func (b *FileBuilder) save() (string, error) {
- d := openfile(w32.OFN_OVERWRITEPROMPT, b)
- if w32.GetSaveFileName(d.opf) {
- return d.Filename(), nil
- }
- return "", err()
-}
-
-/* syscall.UTF16PtrFromString not sufficient because we need to encode embedded NUL bytes */
-func utf16ptr(utf16 []uint16) *uint16 {
- if utf16[len(utf16)-1] != 0 {
- panic("refusing to make ptr to non-NUL terminated utf16 slice")
- }
- h := (*reflect.SliceHeader)(unsafe.Pointer(&utf16))
- return (*uint16)(unsafe.Pointer(h.Data))
-}
-
-func utf16slice(ptr *uint16) []uint16 {
- hdr := reflect.SliceHeader{Data: uintptr(unsafe.Pointer(ptr)), Len: 1, Cap: 1}
- slice := *((*[]uint16)(unsafe.Pointer(&hdr)))
- i := 0
- for slice[len(slice)-1] != 0 {
- i++
- }
- hdr.Len = i
- slice = *((*[]uint16)(unsafe.Pointer(&hdr)))
- return slice
-}
-
-func openfile(flags uint32, b *FileBuilder) (d filedlg) {
- d.buf = make([]uint16, w32.MAX_PATH)
- d.opf = &w32.OPENFILENAME{
- File: utf16ptr(d.buf),
- MaxFile: uint32(len(d.buf)),
- Flags: flags,
- }
- d.opf.StructSize = uint32(unsafe.Sizeof(*d.opf))
- if b.StartDir != "" {
- d.opf.InitialDir, _ = syscall.UTF16PtrFromString(b.StartDir)
- }
- if b.Dlg.Title != "" {
- d.opf.Title, _ = syscall.UTF16PtrFromString(b.Dlg.Title)
- }
- for _, filt := range b.Filters {
- /* build utf16 string of form "Music File\0*.mp3;*.ogg;*.wav;\0" */
- d.filters = append(d.filters, utf16.Encode([]rune(filt.Desc))...)
- d.filters = append(d.filters, 0)
- for _, ext := range filt.Extensions {
- s := fmt.Sprintf("*.%s;", ext)
- d.filters = append(d.filters, utf16.Encode([]rune(s))...)
- }
- d.filters = append(d.filters, 0)
- }
- if d.filters != nil {
- d.filters = append(d.filters, 0, 0) // two extra NUL chars to terminate the list
- d.opf.Filter = utf16ptr(d.filters)
- }
- return d
-}
-
-type dirdlg struct {
- bi *w32.BROWSEINFO
-}
-
-func selectdir(b *DirectoryBuilder) (d dirdlg) {
- d.bi = &w32.BROWSEINFO{Flags: w32.BIF_RETURNONLYFSDIRS}
- if b.Dlg.Title != "" {
- d.bi.Title, _ = syscall.UTF16PtrFromString(b.Dlg.Title)
- }
- return d
-}
-
-func (b *DirectoryBuilder) browse() (string, error) {
- d := selectdir(b)
- res := w32.SHBrowseForFolder(d.bi)
- if res == 0 {
- return "", Cancelled
- }
- return w32.SHGetPathFromIDList(res), nil
-}
diff --git a/vendor/0xacab.org/leap/go-dialog/util.go b/vendor/0xacab.org/leap/go-dialog/util.go
deleted file mode 100644
index 28126ee..0000000
--- a/vendor/0xacab.org/leap/go-dialog/util.go
+++ /dev/null
@@ -1,10 +0,0 @@
-package dialog
-
-func firstOf(args ...string) string {
- for _, arg := range args {
- if arg != "" {
- return arg
- }
- }
- return ""
-}