Wine support work continued
This commit is contained in:
@@ -25,7 +25,6 @@ Photos are found [Here](https://goo.gl/photos/VtBUL6DyZTMidj5n6)
|
||||
|
||||
# TODO (Might be in order)
|
||||
1. MAKE IT BETTER
|
||||
1. Launching of .exe files via wine (wine will have to be installed on the host system, unless there is some portable wine (I may have found one))
|
||||
1. Add settings menu
|
||||
1. Add updater for .AppImage files
|
||||
1. Download .AppImage files (maybe)
|
||||
|
||||
@@ -14,6 +14,8 @@ import (
|
||||
var (
|
||||
appMaster map[string][]prtap
|
||||
cats []string
|
||||
wineOnly []string
|
||||
linOnly []string
|
||||
conf *os.File
|
||||
common string
|
||||
commEnbl bool
|
||||
@@ -44,7 +46,7 @@ func main() {
|
||||
appstmp, _ := pa.Readdir(-1)
|
||||
var folds []string
|
||||
for _, v := range appstmp {
|
||||
if v.IsDir() && v.Name() != "LinuxPACom" {
|
||||
if v.IsDir() && v.Name() != "LinuxPACom" && v.Name() != "PortableApps.com" {
|
||||
folds = append(folds, v.Name())
|
||||
}
|
||||
}
|
||||
@@ -54,11 +56,29 @@ func main() {
|
||||
pat := processApp(fi)
|
||||
if (pat != prtap{}) {
|
||||
if _, ok := appMaster[pat.cat]; !ok {
|
||||
cats = append(cats, pat.cat)
|
||||
if pat.wine {
|
||||
wineOnly = append(wineOnly, pat.cat)
|
||||
cats = append(cats, pat.cat)
|
||||
} else {
|
||||
linOnly = append(linOnly, pat.cat)
|
||||
cats = append(cats, pat.cat)
|
||||
}
|
||||
} else {
|
||||
if !pat.wine {
|
||||
for i, v := range wineOnly {
|
||||
if pat.cat == v {
|
||||
wineOnly = append(wineOnly[:i], wineOnly[i+1:]...)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
appMaster[pat.cat] = append(appMaster[pat.cat], pat)
|
||||
}
|
||||
}
|
||||
sort.Strings(linOnly)
|
||||
sort.Strings(wineOnly)
|
||||
sort.Strings(cats)
|
||||
gl.StartDriver(uiMain)
|
||||
}
|
||||
|
||||
@@ -73,13 +93,13 @@ func processApp(fi *os.File) (out prtap) {
|
||||
fil, _ = os.Open(fi.Name() + "/appinfo.ini")
|
||||
out.cat = getCat(fil)
|
||||
} else {
|
||||
out.cat = "other"
|
||||
out.cat = "Other"
|
||||
}
|
||||
if out.name == "" {
|
||||
out.name = path.Base(fi.Name())
|
||||
}
|
||||
if out.cat == "" {
|
||||
out.cat = "other"
|
||||
out.cat = "Other"
|
||||
}
|
||||
//executable detection
|
||||
wd, _ := os.Getwd()
|
||||
|
||||
+6
-2
@@ -27,7 +27,9 @@ func (p *prtapAdap) SetApps(apps []prtap) {
|
||||
} else {
|
||||
p.cur = make([]prtap, 0)
|
||||
for _, v := range p.master {
|
||||
p.cur = append(p.cur, v)
|
||||
if !v.wine {
|
||||
p.cur = append(p.cur, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
p.DataChanged(false)
|
||||
@@ -44,7 +46,9 @@ func (p *prtapAdap) Wine(show bool) {
|
||||
} else {
|
||||
p.cur = make([]prtap, 0)
|
||||
for _, v := range p.master {
|
||||
p.cur = append(p.cur, v)
|
||||
if !v.wine {
|
||||
p.cur = append(p.cur, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
p.DataChanged(false)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
@@ -16,8 +17,9 @@ var (
|
||||
func uiMain(dri gxui.Driver) {
|
||||
dr = dri
|
||||
catAdap := &StrList{}
|
||||
catAdap.SetStrings(cats)
|
||||
catAdap.SetStrings(linOnly)
|
||||
appAdap := &prtapAdap{}
|
||||
appAdap.Wine(false)
|
||||
th := dark.CreateTheme(dr)
|
||||
win := th.CreateWindow(500, 500, "LinuxPA")
|
||||
top := th.CreateLinearLayout()
|
||||
@@ -59,18 +61,25 @@ func uiMain(dri gxui.Driver) {
|
||||
cmd.Start()
|
||||
}
|
||||
})
|
||||
wine := th.CreateButton()
|
||||
wine.SetType(gxui.ToggleButton)
|
||||
wine.OnClick(func(gxui.MouseEvent) {
|
||||
if wine.IsChecked() {
|
||||
appAdap.Wine(true)
|
||||
} else {
|
||||
appAdap.Wine(false)
|
||||
}
|
||||
})
|
||||
wine.SetText("Show Windows apps")
|
||||
wine.SetChecked(appAdap.wine)
|
||||
but.AddChild(wine)
|
||||
if _, err := exec.LookPath("wine"); err == nil {
|
||||
fmt.Println("Wine found!")
|
||||
wine := th.CreateButton()
|
||||
wine.SetType(gxui.ToggleButton)
|
||||
wine.OnClick(func(gxui.MouseEvent) {
|
||||
if wine.IsChecked() {
|
||||
catAdap.SetStrings(cats)
|
||||
appAdap.Wine(true)
|
||||
} else {
|
||||
catAdap.SetStrings(linOnly)
|
||||
appAdap.Wine(false)
|
||||
}
|
||||
})
|
||||
wine.SetText("Show Windows Apps")
|
||||
wine.SetChecked(appAdap.wine)
|
||||
but.AddChild(wine)
|
||||
} else {
|
||||
fmt.Println("Wine not found!")
|
||||
}
|
||||
but.AddChild(launch)
|
||||
top.AddChild(but)
|
||||
top.AddChild(spl)
|
||||
|
||||
Reference in New Issue
Block a user