forked from Silverfish/proton-bridge
Other: reactive show on startup
This commit is contained in:
@ -188,6 +188,10 @@ QtObject {
|
|||||||
mainWindow.showAndRise()
|
mainWindow.showAndRise()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (root.backend.showOnStartup) {
|
||||||
|
mainWindow.showAndRise()
|
||||||
|
}
|
||||||
|
|
||||||
root.backend.guiReady()
|
root.backend.guiReady()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ type FrontendQt struct {
|
|||||||
noEncConfirmator types.NoEncConfirmator
|
noEncConfirmator types.NoEncConfirmator
|
||||||
autostart *autostart.App
|
autostart *autostart.App
|
||||||
restarter types.Restarter
|
restarter types.Restarter
|
||||||
|
showOnStartup bool
|
||||||
|
|
||||||
authClient pmapi.Client
|
authClient pmapi.Client
|
||||||
auth *pmapi.Auth
|
auth *pmapi.Auth
|
||||||
@ -100,19 +101,13 @@ func New(
|
|||||||
bridge: bridge,
|
bridge: bridge,
|
||||||
autostart: autostart,
|
autostart: autostart,
|
||||||
restarter: restarter,
|
restarter: restarter,
|
||||||
|
showOnStartup: showWindowOnStart,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initializing.Done is only called sync.Once. Please keep the increment
|
// Initializing.Done is only called sync.Once. Please keep the increment
|
||||||
// set to 1
|
// set to 1
|
||||||
f.initializing.Add(1)
|
f.initializing.Add(1)
|
||||||
|
|
||||||
if showWindowOnStart {
|
|
||||||
go func() {
|
|
||||||
f.initializing.Wait()
|
|
||||||
f.qml.ShowMainWindow()
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,8 @@ type QMLBackend struct {
|
|||||||
_ func() `slot:"quit"`
|
_ func() `slot:"quit"`
|
||||||
_ func() `slot:"restart"`
|
_ func() `slot:"restart"`
|
||||||
|
|
||||||
|
_ bool `property:showOnStartup`
|
||||||
|
|
||||||
_ bool `property:dockIconVisible`
|
_ bool `property:dockIconVisible`
|
||||||
|
|
||||||
_ QMLUserModel `property:"users"`
|
_ QMLUserModel `property:"users"`
|
||||||
@ -144,6 +146,10 @@ func (q *QMLBackend) setup(f *FrontendQt) {
|
|||||||
q.ConnectRestart(f.restart)
|
q.ConnectRestart(f.restart)
|
||||||
q.ConnectGuiReady(f.guiReady)
|
q.ConnectGuiReady(f.guiReady)
|
||||||
|
|
||||||
|
q.ConnectIsShowOnStartup(func() bool {
|
||||||
|
return f.showOnStartup
|
||||||
|
})
|
||||||
|
|
||||||
q.ConnectIsDockIconVisible(func() bool {
|
q.ConnectIsDockIconVisible(func() bool {
|
||||||
return dockIcon.GetDockIconVisibleState()
|
return dockIcon.GetDockIconVisibleState()
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user