Finished up downloading
This commit is contained in:
+1
-3
@@ -1,13 +1,11 @@
|
|||||||
package appimg
|
package appimg
|
||||||
|
|
||||||
type appimg struct {
|
type appimg struct {
|
||||||
url string
|
|
||||||
name string
|
name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func newApp(url, name string) appimg {
|
func newApp(name string) appimg {
|
||||||
var out appimg
|
var out appimg
|
||||||
out.url = url
|
|
||||||
out.name = name
|
out.name = name
|
||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -28,6 +28,7 @@ func downloadApp(parent *gtk.Window, ap appimg) {
|
|||||||
box.Add(spn)
|
box.Add(spn)
|
||||||
box.Add(lbl)
|
box.Add(lbl)
|
||||||
win.Add(box)
|
win.Add(box)
|
||||||
|
win.SetPosition(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||||
win.ShowAll()
|
win.ShowAll()
|
||||||
win.Show()
|
win.Show()
|
||||||
go func(win *gtk.Window, ap appimg) {
|
go func(win *gtk.Window, ap appimg) {
|
||||||
@@ -38,7 +39,7 @@ func downloadApp(parent *gtk.Window, ap appimg) {
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
resp, err := check.Get(urlBase + ap.url)
|
resp, err := check.Get(urlBase + ap.name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
return
|
return
|
||||||
|
|||||||
+3
-2
@@ -40,6 +40,7 @@ func ShowUI(clsFunc func()) {
|
|||||||
downloadApp(win, apps[appList.GetSelectedRow().GetIndex()])
|
downloadApp(win, apps[appList.GetSelectedRow().GetIndex()])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
win.SetPosition(gtk.WIN_POS_CENTER_ON_PARENT)
|
||||||
win.ShowAll()
|
win.ShowAll()
|
||||||
win.Show()
|
win.Show()
|
||||||
getList(win, apch)
|
getList(win, apch)
|
||||||
@@ -56,7 +57,7 @@ func ShowUI(clsFunc func()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getList(parent *gtk.Window, apch chan appimg) {
|
func getList(parent *gtk.Window, apch chan appimg) {
|
||||||
win, _ := gtk.WindowNew(gtk.WINDOW_TOPLEVEL)
|
win, _ := gtk.WindowNew(gtk.WINDOW_POPUP)
|
||||||
win.SetTransientFor(parent)
|
win.SetTransientFor(parent)
|
||||||
win.SetDestroyWithParent(true)
|
win.SetDestroyWithParent(true)
|
||||||
win.Connect("destroy", func() {
|
win.Connect("destroy", func() {
|
||||||
@@ -102,7 +103,7 @@ func getList(parent *gtk.Window, apch chan appimg) {
|
|||||||
tgs := convert(string(btys))
|
tgs := convert(string(btys))
|
||||||
for _, v := range tgs {
|
for _, v := range tgs {
|
||||||
if strings.HasSuffix(strings.ToLower(v.Meat), ".appimage") {
|
if strings.HasSuffix(strings.ToLower(v.Meat), ".appimage") {
|
||||||
apch <- newApp(v.value("href"), v.Meat)
|
apch <- newApp(v.Meat)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(apch)
|
close(apch)
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ func getIcon(fold string) *gdk.Pixbuf {
|
|||||||
pic = fold + "/appicon.png"
|
pic = fold + "/appicon.png"
|
||||||
} else {
|
} else {
|
||||||
img, _ := gtk.ImageNewFromIconName("application-x-executable", gtk.ICON_SIZE_BUTTON)
|
img, _ := gtk.ImageNewFromIconName("application-x-executable", gtk.ICON_SIZE_BUTTON)
|
||||||
buf, _ := img.GetPixbuf().ScaleSimple(32, 32, gdk.INTERP_BILINEAR)
|
buf := img.GetPixbuf()
|
||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
img, _ := gtk.ImageNewFromFile(pic)
|
img, _ := gtk.ImageNewFromFile(pic)
|
||||||
|
|||||||
Reference in New Issue
Block a user