Add Default visibility setting for panes

This commit is contained in:
Christian Muehlhaeuser 2020-03-03 06:30:33 +01:00
parent 45af81d34c
commit 8b3e6ce116
No known key found for this signature in database
GPG key ID: 3CF9FA45CA1EBB7E
3 changed files with 18 additions and 8 deletions

View file

@ -22,8 +22,9 @@ type Account interface {
}
type Pane struct {
ID string
Title string
Sticky bool
Stream func(ch chan interface{}) error
ID string
Title string
Sticky bool
Default bool
Stream func(ch chan interface{}) error
}

View file

@ -9,6 +9,7 @@ const (
PaneID = int(core.Qt__UserRole) + iota
PaneName
PaneSticky
PaneDefault
MsgModel
)
@ -30,10 +31,11 @@ type PaneModel struct {
type Pane struct {
core.QObject
ID string
Name string
Sticky bool
Model *MessageModel
ID string
Name string
Sticky bool
Default bool
Model *MessageModel
}
func (m *PaneModel) init() {

View file

@ -82,6 +82,7 @@ func setupMastodon(config Account) {
pane.ID = "notifications"
pane.Name = "Notifications"
pane.Sticky = true
pane.Default = true
pane.Model = notificationModel
paneModel.AddPane(pane)
}
@ -89,12 +90,17 @@ func setupMastodon(config Account) {
var pane = NewPane(nil)
pane.ID = "home"
pane.Name = "Messages"
pane.Default = true
pane.Model = postModel
paneModel.AddPane(pane)
}
panes := tc.Panes()
for _, p := range panes {
if !p.Default {
continue
}
model := NewMessageModel(nil)
evchan := make(chan interface{})
@ -104,6 +110,7 @@ func setupMastodon(config Account) {
var pane = NewPane(nil)
pane.ID = p.ID
pane.Name = p.Title
pane.Default = p.Default
pane.Model = model
paneModel.AddPane(pane)
}