-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
54 lines (41 loc) · 1.14 KB
/
Copy pathmain.go
File metadata and controls
54 lines (41 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package main
import (
"context"
"log"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/theme"
"github.com/farbodahm/delephon/store"
)
func main() {
st, err := store.New()
if err != nil {
log.Fatalf("Failed to initialize storage: %v", err)
}
defer st.Close()
fyneApp := app.New()
// Load theme preference or follow system default
variant, _ := st.GetSetting("theme_variant")
switch variant {
case "light":
appTheme.SetVariant(theme.VariantLight)
case "dark":
appTheme.SetVariant(theme.VariantDark)
default:
appTheme.SetVariant(fyneApp.Settings().ThemeVariant())
}
fyneApp.Settings().SetTheme(appTheme)
window := fyneApp.NewWindow("Delephon — BigQuery Client")
window.Resize(fyne.NewSize(1280, 800))
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
application := NewApp(window, st, ctx)
defer application.Close()
window.SetContent(application.BuildUI())
// Load favorites + recent projects from local DB (no GCP API call)
application.LoadInitialProjects()
// Load history and favorites from local DB
go application.refreshHistory()
go application.refreshFavorites()
window.ShowAndRun()
}