Skip to content

Commit

Permalink
Use go:embed for bundling the icon
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz committed Jun 6, 2022
1 parent 63363d2 commit d6fea8b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 18 deletions.
15 changes: 11 additions & 4 deletions internal/assets/assets.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
// Package assets contains bundled static resources.
package assets

//go:generate fyne bundle -package assets -o bundled.go icon
import (
_ "embed"

// AppIcon contains the main application icon.
// TODO: Use go:embed for the next big release.
var AppIcon = resourceIcon512Png
"fyne.io/fyne/v2"
)

//go:embed icon/icon-512.png
var icon []byte

var Icon = &fyne.StaticResource{
StaticContent: icon,
}
12 changes: 0 additions & 12 deletions internal/assets/bundled.go

This file was deleted.

2 changes: 1 addition & 1 deletion internal/ui/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func newAbout() *about {
}

func (a *about) buildUI() *fyne.Container {
a.icon = canvas.NewImageFromResource(assets.AppIcon)
a.icon = canvas.NewImageFromResource(assets.Icon)
a.icon.SetMinSize(fyne.NewSize(256, 256))

a.nameLabel = newBoldLabel("Rymdport")
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

func main() {
a := app.NewWithID("io.github.jacalz.rymdport")
a.SetIcon(assets.AppIcon)
a.SetIcon(assets.Icon)
w := a.NewWindow("Rymdport")

w.SetContent(ui.Create(a, w))
Expand Down

0 comments on commit d6fea8b

Please sign in to comment.