aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorKoni Marti <koni.marti@gmail.com>2024-08-07 20:52:36 +0200
committerRobin Jarry <robin@jarry.cc>2024-08-20 12:26:47 +0200
commit054b5edc002008f20210f79e384381560a4f753d (patch)
tree293de9ab7e517bd16467ea77b17790e710a56362 /app
parentdedf7b58037651f3d63a78fc25bd9b319cbaa374 (diff)
downloadaerc-054b5edc002008f20210f79e384381560a4f753d.tar.gz
store: extract configure logic
Extract a function to configure the message store from its constructor to reconfigure the store when the data changes. Signed-off-by: Koni Marti <koni.marti@gmail.com> Tested-by: Inwit <inwit@sindominio.net> Acked-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'app')
-rw-r--r--app/account.go20
1 files changed, 8 insertions, 12 deletions
diff --git a/app/account.go b/app/account.go
index 2f9cdf99..45321755 100644
--- a/app/account.go
+++ b/app/account.go
@@ -263,15 +263,11 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}
backend := acct.AccountConfig().Backend
store := lib.NewMessageStore(acct.worker, name,
- acct.sortCriteria(uiConf),
- uiConf.ThreadingEnabled,
- uiConf.ForceClientThreads,
- uiConf.ClientThreadsDelay,
- uiConf.SelectLast,
- uiConf.ThreadingBySubject,
- uiConf.ReverseOrder,
- uiConf.ReverseThreadOrder,
- uiConf.SortThreadSiblings,
+ func() *config.UIConfig {
+ return config.Ui.
+ ForAccount(acct.Name()).
+ ForFolder(name)
+ },
func(msg *models.MessageInfo) {
err := hooks.RunHook(&hooks.MailReceived{
Account: acct.Name(),
@@ -335,8 +331,8 @@ func (acct *AccountView) newStore(name string) *lib.MessageStore {
}
},
acct.updateSplitView,
- acct.dirlist.UiConfig(name).ThreadContext,
)
+ store.Configure(acct.SortCriteria(uiConf))
store.SetMarker(marker.New(store))
return store
}
@@ -504,7 +500,7 @@ func (acct *AccountView) updateDirCounts(destination string, uids []uint32) {
}
}
-func (acct *AccountView) sortCriteria(uiConf *config.UIConfig) []*types.SortCriterion {
+func (acct *AccountView) SortCriteria(uiConf *config.UIConfig) []*types.SortCriterion {
if uiConf == nil {
return nil
}
@@ -520,7 +516,7 @@ func (acct *AccountView) sortCriteria(uiConf *config.UIConfig) []*types.SortCrit
}
func (acct *AccountView) GetSortCriteria() []*types.SortCriterion {
- return acct.sortCriteria(acct.UiConfig())
+ return acct.SortCriteria(acct.UiConfig())
}
func (acct *AccountView) CheckMail() {