Fallback icon set now has general MIME icons support
Specifically, it supports all the XDG x-generic icons.
This commit is contained in:
@@ -11,6 +11,7 @@ import "git.tebibyte.media/tomo/tomo"
|
||||
import "git.tebibyte.media/tomo/tomo/data"
|
||||
import "git.tebibyte.media/tomo/tomo/canvas"
|
||||
import "git.tebibyte.media/tomo/backend/style"
|
||||
import "git.tebibyte.media/tomo/nasin/internal/util"
|
||||
import xdgIconTheme "git.tebibyte.media/tomo/xdg/icon-theme"
|
||||
|
||||
type iconTheme struct {
|
||||
@@ -113,7 +114,7 @@ func (this *iconTheme) mimeIcon (mime data.Mime, size tomo.IconSize) canvas.Text
|
||||
if texture, ok := this.xdgIcon(xdgFormatMime(mime), size); ok {
|
||||
return texture
|
||||
}
|
||||
if texture, ok := this.xdgIcon(xdgFormatMime(generalizeMimeType(mime)), size); ok {
|
||||
if texture, ok := this.xdgIcon(xdgFormatMime(util.GeneralizeXDGIconMimeType(mime)), size); ok {
|
||||
return texture
|
||||
}
|
||||
if texture, ok := this.xdgIcon(xdgFormatMime(data.M("text", "x-generic")), size); ok {
|
||||
@@ -166,13 +167,6 @@ func xdgFormatMime (mime data.Mime) string {
|
||||
return fmt.Sprintf("%s-%s", mime.Type, mime.Subtype)
|
||||
}
|
||||
|
||||
func generalizeMimeType (mime data.Mime) data.Mime {
|
||||
// FIXME make this more accurate
|
||||
// https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
|
||||
mime.Subtype = "x-generic"
|
||||
return mime
|
||||
}
|
||||
|
||||
func iconSizePixels (size tomo.IconSize) int {
|
||||
// TODO: once Tomo has scaling support, take that into account here
|
||||
switch size {
|
||||
|
||||
Reference in New Issue
Block a user