Rename fallback icon set

This commit is contained in:
Sasha Koshka 2024-08-10 22:12:21 -04:00
parent 3127aad09a
commit 961366b00a

View File

@ -412,23 +412,23 @@ func generateSource (data []byte, width int) map[tomo.Icon] canvas.Texture {
return source
}
type iconTheme struct {
type iconSet struct {
texturesSmall map[tomo.Icon] canvas.Texture
texturesLarge map[tomo.Icon] canvas.Texture
}
// New creates a new fallback icon theme.
// New creates a new fallback icon set.
func New () style.IconSet {
return new(iconTheme)
return new(iconSet)
}
func (this *iconTheme) ensure () {
func (this *iconSet) ensure () {
if this.texturesSmall != nil { return }
this.texturesSmall = generateSource(atlasSmallBytes, 16)
this.texturesLarge = generateSource(atlasLargeBytes, 32)
}
func (this *iconTheme) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
func (this *iconSet) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.Texture {
if size == tomo.IconSizeSmall {
return this.texturesSmall
} else {
@ -436,7 +436,7 @@ func (this *iconTheme) selectSource (size tomo.IconSize) map[tomo.Icon] canvas.T
}
}
func (this *iconTheme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
func (this *iconSet) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture {
this.ensure()
source := this.selectSource(size)
if texture, ok := source[icon]; ok {
@ -445,7 +445,7 @@ func (this *iconTheme) Icon (icon tomo.Icon, size tomo.IconSize) canvas.Texture
return nil
}
func (this *iconTheme) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
func (this *iconSet) MimeIcon (mime data.Mime, size tomo.IconSize) canvas.Texture {
this.ensure()
source := this.selectSource(size)
if mime == data.M("inode", "directory") {