mirror of
https://github.com/muesli/telephant
synced 2025-02-16 11:48:22 +00:00
Add Default visibility setting for panes
This commit is contained in:
parent
45af81d34c
commit
8b3e6ce116
3 changed files with 18 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
|
|
10
panemodel.go
10
panemodel.go
|
@ -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() {
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue