mirror of
https://github.com/ProtonMail/proton-bridge.git
synced 2025-12-22 18:16:43 +00:00
GODT-919 GODT-1022 GODT-947 Logs and signals
+ Added startup logs + Added wait group for update notifications + Changed hooks in debug and trace level
This commit is contained in:
@ -22,6 +22,7 @@ package qtie
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
"github.com/ProtonMail/proton-bridge/internal/config/settings"
|
||||
"github.com/ProtonMail/proton-bridge/internal/events"
|
||||
@ -76,6 +77,9 @@ type FrontendQt struct {
|
||||
|
||||
// saving most up-to-date update info to install it manually
|
||||
updateInfo updater.VersionInfo
|
||||
|
||||
initializing sync.WaitGroup
|
||||
initializationDone sync.Once
|
||||
}
|
||||
|
||||
// New is constructor for Import-Export Qt-Go interface
|
||||
@ -102,6 +106,10 @@ func New(
|
||||
restarter: restarter,
|
||||
}
|
||||
|
||||
// Initializing.Done is only called sync.Once. Please keep the increment
|
||||
// set to 1
|
||||
f.initializing.Add(1)
|
||||
|
||||
log.Debugf("New Qt frontend: %p", f)
|
||||
return f
|
||||
}
|
||||
@ -541,3 +549,14 @@ func (f *FrontendQt) createLabelOrFolder(email, name, color string, isLabel bool
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func (f *FrontendQt) WaitUntilFrontendIsReady() {
|
||||
f.initializing.Wait()
|
||||
}
|
||||
|
||||
// setGUIIsReady unlocks the WaitUntilFrontendIsReady.
|
||||
func (f *FrontendQt) setGUIIsReady() {
|
||||
f.initializationDone.Do(func() {
|
||||
f.initializing.Done()
|
||||
})
|
||||
}
|
||||
|
||||
@ -50,6 +50,9 @@ func (s *FrontendHeadless) NotifyManualUpdate(update updater.VersionInfo, canIns
|
||||
func (s *FrontendHeadless) SetVersion(update updater.VersionInfo) {
|
||||
}
|
||||
|
||||
func (s *FrontendHeadless) WaitUntilFrontendIsReady() {
|
||||
}
|
||||
|
||||
func (s *FrontendHeadless) NotifySilentUpdateInstalled() {
|
||||
}
|
||||
|
||||
|
||||
@ -67,6 +67,7 @@ type GoQMLInterface struct {
|
||||
_ func() `slot:"checkAndOpenReleaseNotes"`
|
||||
_ func() `signal:"openReleaseNotesExternally"`
|
||||
_ func() `slot:"startManualUpdate"`
|
||||
_ func() `slot:"guiIsReady"`
|
||||
|
||||
// translations
|
||||
_ string `property:"wrongCredentials"`
|
||||
@ -201,6 +202,8 @@ func (s *GoQMLInterface) SetFrontend(f *FrontendQt) {
|
||||
s.ConnectStartExport(f.StartExport)
|
||||
s.ConnectStartImport(f.StartImport)
|
||||
|
||||
s.ConnectGuiIsReady(f.setGUIIsReady)
|
||||
|
||||
s.ConnectCheckPathStatus(CheckPathStatus)
|
||||
|
||||
s.ConnectEmitEvent(f.emitEvent)
|
||||
|
||||
Reference in New Issue
Block a user