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