mirror of
https://github.com/gen2brain/cbconvert
synced 2026-06-30 09:11:54 +02:00
Remove dbus portal
This commit is contained in:
@@ -957,3 +957,52 @@ func onFilterChanged(ih iup.Ihandle) int {
|
||||
|
||||
return iup.DEFAULT
|
||||
}
|
||||
|
||||
func fileDlg(title string, multiple, directory bool) ([]string, error) {
|
||||
ret := make([]string, 0)
|
||||
|
||||
dlg := iup.FileDlg()
|
||||
defer dlg.Destroy()
|
||||
|
||||
if !directory {
|
||||
mf := "YES"
|
||||
if !multiple {
|
||||
mf = "NO"
|
||||
}
|
||||
|
||||
dlg.SetAttributes(map[string]string{
|
||||
"DIALOGTYPE": "OPEN",
|
||||
"MULTIPLEFILES": mf,
|
||||
"EXTFILTER": "Comic Files|*.rar;*.zip;*.7z;*.tar;*.cbr;*.cbz;*.cb7;*.cbt;*.pdf;*.epub;*.mobi;*.docx;*.pptx|",
|
||||
"FILTER": "*.cb*", // for Motif
|
||||
"TITLE": title,
|
||||
})
|
||||
} else {
|
||||
dlg.SetAttributes(map[string]string{
|
||||
"DIALOGTYPE": "DIR",
|
||||
"TITLE": title,
|
||||
})
|
||||
}
|
||||
|
||||
iup.Popup(dlg, iup.CENTERPARENT, iup.CENTERPARENT)
|
||||
|
||||
if dlg.GetInt("STATUS") == 0 {
|
||||
if !directory {
|
||||
value := dlg.GetAttribute("VALUE")
|
||||
sp := strings.Split(value, "|")
|
||||
|
||||
if len(sp) > 1 {
|
||||
for _, file := range sp[1 : len(sp)-1] {
|
||||
ret = append(ret, filepath.Join(sp[0], file))
|
||||
}
|
||||
} else {
|
||||
ret = append(ret, value)
|
||||
}
|
||||
} else {
|
||||
value := dlg.GetAttribute("VALUE")
|
||||
ret = append(ret, value)
|
||||
}
|
||||
}
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user