mirror of
https://github.com/Xevion/glance.git
synced 2025-12-15 06:11:59 -06:00
Update icons implementation to use custom type
This commit is contained in:
@@ -13,32 +13,17 @@ type Bookmarks struct {
|
||||
Title string `yaml:"title"`
|
||||
Color *HSLColorField `yaml:"color"`
|
||||
Links []struct {
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Icon string `yaml:"icon"`
|
||||
IsSimpleIcon bool `yaml:"-"`
|
||||
IconSource IconSource `yaml:"-"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
HideArrow bool `yaml:"hide-arrow"`
|
||||
Title string `yaml:"title"`
|
||||
URL string `yaml:"url"`
|
||||
Icon CustomIcon `yaml:"icon"`
|
||||
SameTab bool `yaml:"same-tab"`
|
||||
HideArrow bool `yaml:"hide-arrow"`
|
||||
} `yaml:"links"`
|
||||
} `yaml:"groups"`
|
||||
}
|
||||
|
||||
func (widget *Bookmarks) Initialize() error {
|
||||
widget.withTitle("Bookmarks").withError(nil)
|
||||
|
||||
for g := range widget.Groups {
|
||||
for l := range widget.Groups[g].Links {
|
||||
if widget.Groups[g].Links[l].Icon == "" {
|
||||
continue
|
||||
}
|
||||
|
||||
link := &widget.Groups[g].Links[l]
|
||||
link.Icon, link.IconSource = toIconURIIfPrefixed(link.Icon)
|
||||
link.IsSimpleIcon = link.IconSource == SimpleIcon
|
||||
}
|
||||
}
|
||||
|
||||
widget.cachedHTML = widget.render(widget, assets.BookmarksTemplate)
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user