Fixed title for Trending topic buffers after a restart. Closes #421

This commit is contained in:
2021-11-01 05:18:46 -06:00
parent ff0a2b5692
commit 84fa2fad91
3 changed files with 9 additions and 5 deletions

View File

@@ -49,6 +49,7 @@ class TrendsBuffer(base.Buffer):
log.exception("Error %s" % (str(err)))
if not hasattr(self, "name_"):
self.name_ = data[0]["locations"][0]["name"]
pub.sendMessage("buffer-title-changed", buffer=self)
self.trends = data[0]["trends"]
self.put_items_on_the_list()
if self.sound != None and self.session.settings["sound"]["session_mute"] == False and self.name not in self.session.settings["other_buffers"]["muted_buffers"] and play_sound == True:

View File

@@ -1581,14 +1581,16 @@ class Controller(object):
output.speak(_(u"{0} items retrieved").format(n,))
def buffer_title_changed(self, buffer):
if "-timeline" in buffer.name:
if buffer.name.endswith("-timeline"):
title = _(u"Timeline for {}").format(buffer.username,)
elif "-favorite" in buffer.name:
elif buffer.name.endswith("-favorite"):
title = _(u"Likes for {}").format(buffer.username,)
elif "-followers" in buffer.name:
elif buffer.name.endswith("-followers"):
title = _(u"Followers for {}").format(buffer.username,)
elif "-friends" in buffer.name:
elif buffer.name.endswith("-friends"):
title = _(u"Friends for {}").format(buffer.username,)
elif buffer.name.endswith("_tt"):
title = _("Trending topics for %s") % (buffer.name_)
buffer_index = self.view.search(buffer.name, buffer.account)
self.view.set_page_title(buffer_index, title)