change toolbar title

This commit is contained in:
erinn 2019-02-01 16:27:17 -08:00
parent 6652d57018
commit f4ab436993
2 changed files with 20 additions and 1 deletions

View File

@ -35,6 +35,7 @@ type GrandCentralDispatcher struct {
_ func() `signal:"ClearMessages"`
_ func() `signal:"ResetMessagePane"`
_ func(mID uint) `signal:"Acknowledged"`
_ func(title string) `signal:"SetToolbarTitle"`
// profile-area stuff
_ func(name, onion, image string) `signal:"UpdateMyProfile"`
@ -115,7 +116,14 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
if len(handle) == 32 { // LOAD GROUP
log.Debugf("LOADING GROUP %s", handle)
tl := the.Peer.GetGroup(handle).GetTimeline()
group := the.Peer.GetGroup(handle)
tl := group.GetTimeline()
nick, _ := group.GetAttribute("nick")
if nick == "" {
this.SetToolbarTitle(handle)
} else {
this.SetToolbarTitle(nick)
}
log.Debugf("messages: %d", len(tl))
for i := range tl {
if tl[i].PeerID == the.Peer.GetProfile().Onion {
@ -143,6 +151,13 @@ func (this *GrandCentralDispatcher) loadMessagesPane(handle string) {
return
} // ELSE LOAD CONTACT
nick, _ := the.Peer.GetProfile().GetAttribute(handle + "_name")
if nick == "" {
this.SetToolbarTitle(handle)
} else {
this.SetToolbarTitle(nick)
}
messages := this.UIState.GetMessages(handle)
for i := range messages {
from := messages[i].From

View File

@ -205,5 +205,9 @@ Item {
popup.visible = true
anmPopup.restart()
}
onSetToolbarTitle: function(str) {
theStack.title = str
}
}
}