aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJeffas <dev@jeffas.io>2019-10-02 11:24:12 +0100
committerDrew DeVault <sir@cmpwn.com>2019-10-09 19:46:43 -0400
commit1339faf7881f33762c6e0a4915404e362fc51de1 (patch)
treee8ffd3d7827a9753c2290869839e77bbe50aa6d3 /lib
parent00b9ca503286d5dc43def31db713e853c8aeee13 (diff)
Show spinner when fetching contents
The spinner should be shown when fetching the contents as we don't know at that point whether there are some messages or not.
Diffstat (limited to 'lib')
-rw-r--r--lib/msgstore.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/msgstore.go b/lib/msgstore.go
index b0392ba..8cceed8 100644
--- a/lib/msgstore.go
+++ b/lib/msgstore.go
@@ -10,9 +10,10 @@ import (
// Accesses to fields must be guarded by MessageStore.Lock/Unlock
type MessageStore struct {
- Deleted map[uint32]interface{}
- DirInfo models.DirectoryInfo
- Messages map[uint32]*models.MessageInfo
+ Deleted map[uint32]interface{}
+ DirInfo models.DirectoryInfo
+ Messages map[uint32]*models.MessageInfo
+ FetchingContents bool
// Ordered list of known UIDs
uids []uint32
@@ -159,6 +160,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
store.worker.PostAction(&types.FetchDirectoryContents{
SortCriteria: store.defaultSortCriteria,
}, nil)
+ store.FetchingContents = true
update = true
case *types.DirectoryContents:
newMap := make(map[uint32]*models.MessageInfo)
@@ -172,6 +174,7 @@ func (store *MessageStore) Update(msg types.WorkerMessage) {
}
store.Messages = newMap
store.uids = msg.Uids
+ store.FetchingContents = false
update = true
case *types.MessageInfo:
if existing, ok := store.Messages[msg.Info.Uid]; ok && existing != nil {