Commit ee8ecd9d authored by Roman Alifanov's avatar Roman Alifanov

Add 'no updates' page and fix update loading logic

parent 6fd59cda
......@@ -40,16 +40,23 @@ func GetSystemUpdater() *SystemUpdater {
}
var updates map[string]apm.PackageChanges
var updatesLoaded bool
func (su *SystemUpdater) backgroundStart() {
updatesSources := apm.NewUpdatesSources()
us := make(map[string]apm.PackageChanges)
for name, source := range updatesSources {
us[name] = source.GetPackageChanges()
changes := source.GetPackageChanges()
if len(changes.UpgradedPackages) > 0 ||
len(changes.NewInstalledPackages) > 0 ||
len(changes.RemovedPackages) > 0 {
us[name] = changes
}
}
updates = us
updatesLoaded = true
}
func (su *SystemUpdater) onActivate() {
......@@ -61,17 +68,20 @@ func (su *SystemUpdater) onActivate() {
window.Present()
// Это выглядит прям очень плохо... Потом надо бы переделать по уму
glib.TimeoutAdd(100, func() bool {
if !updatesLoaded {
return true
}
if len(updates) > 0 {
window.FillWithChanges(su, updates)
window.stack.SetVisibleChildName("main")
window.updateButton.ConnectActivated(window.StartUpdateProcess)
return false
} else {
window.stack.SetVisibleChildName("noupdates")
}
return true
return false
})
}
......
......@@ -104,6 +104,17 @@
<property name="name">loading</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="child">
<object class="AdwStatusPage">
<property name="icon-name">emblem-ok-symbolic</property>
<property name="title" translatable="yes">System is up to date</property>
</object>
</property>
<property name="name">noupdates</property>
</object>
</child>
</object>
</property>
<property name="top-bar-style">raised</property>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment