Update application.go code
This commit is contained in:
parent
6451050fd3
commit
f22c268a10
@ -8,7 +8,6 @@ import "strings"
|
||||
import "net/url"
|
||||
import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/objects"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/registrar"
|
||||
|
||||
// Application represents an application object.
|
||||
@ -202,22 +201,16 @@ func applicationOpenUrls (application Application, args ...string) {
|
||||
}
|
||||
|
||||
func setApplicationWindowIcon (window tomo.Window, description ApplicationDescription) {
|
||||
allSizes := func (icon tomo.Icon) (sizes []canvas.Texture) {
|
||||
small := icon.Texture(tomo.IconSizeSmall)
|
||||
medium := icon.Texture(tomo.IconSizeMedium)
|
||||
large := icon.Texture(tomo.IconSizeLarge)
|
||||
if small != nil { sizes = append(sizes, small) }
|
||||
if medium != nil { sizes = append(sizes, medium) }
|
||||
if large != nil { sizes = append(sizes, large) }
|
||||
return sizes
|
||||
iconExists := func (icon tomo.Icon) bool {
|
||||
return icon.Texture(tomo.IconSizeMedium) != nil
|
||||
}
|
||||
|
||||
if sizes := allSizes(tomo.Icon(description.ID)); len(sizes) > 0 {
|
||||
window.SetIcon(sizes...)
|
||||
if iconExists(tomo.Icon(description.ID)) {
|
||||
window.SetIcon(tomo.Icon(description.ID))
|
||||
return
|
||||
}
|
||||
if sizes := allSizes(description.Role.Icon()); len(sizes) > 0 {
|
||||
window.SetIcon(sizes...)
|
||||
if iconExists(description.Role.Icon()) {
|
||||
window.SetIcon(description.Role.Icon())
|
||||
return
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user