ui/app,apps/gophers,apps/hello: replace CreateWindow with NewWindow

Gio doesn't support multiple windows anyway, so get rid of the
app.Windows channel and use NewWindow call for the mobile platforms
as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-03-31 13:36:24 +02:00
parent cf258f707f
commit f21b5eb1df
10 changed files with 81 additions and 93 deletions
+10 -15
View File
@@ -119,14 +119,6 @@ func main() {
fmt.Println("The quota for anonymous GitHub API access is very low. Specify a token with -token to avoid quota errors.")
fmt.Println("See https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line.")
}
err := app.CreateWindow(app.WindowOptions{
Width: ui.Dp(400),
Height: ui.Dp(800),
Title: "Gophers",
})
if err != nil {
log.Fatal(err)
}
app.Main()
}
@@ -147,13 +139,16 @@ func init() {
fonts.italic = mustLoadFont(goitalic.TTF)
fonts.mono = mustLoadFont(gomono.TTF)
go func() {
for w := range app.Windows() {
w := w
go func() {
if err := newApp(w).run(); err != nil {
log.Fatal(err)
}
}()
w, err := app.NewWindow(app.WindowOptions{
Width: ui.Dp(400),
Height: ui.Dp(800),
Title: "Gophers",
})
if err != nil {
log.Fatal(err)
}
if err := newApp(w).run(); err != nil {
log.Fatal(err)
}
}()
}