From 0d1d4c887db47f330762832e6912466555678bc2 Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Fri, 11 Nov 2022 17:25:04 -0600 Subject: [PATCH] Added bookmarks buffer --- src/controller/buffers/mastodon/base.py | 4 ++-- src/controller/mastodon/handler.py | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/controller/buffers/mastodon/base.py b/src/controller/buffers/mastodon/base.py index ae5d5a52..2e186f68 100644 --- a/src/controller/buffers/mastodon/base.py +++ b/src/controller/buffers/mastodon/base.py @@ -41,7 +41,7 @@ class BaseBuffer(base.Buffer): def get_buffer_name(self): """ Get buffer name from a set of different techniques.""" # firstly let's take the easier buffers. - basic_buffers = dict(home_timeline=_("Home"), local_timeline=_("Local"), federated_timeline=_("Federated"), mentions=_("Mentions"), direct_messages=_("Direct messages"), sent_direct_messages=_(u"Sent direct messages"), sent_toots=_("Sent toots"), favourites=_("Favorites"), followers=_("Followers"), following=_("Following"), blocked=_(u"Blocked users"), muted=_(u"Muted users")) + basic_buffers = dict(home_timeline=_("Home"), local_timeline=_("Local"), federated_timeline=_("Federated"), mentions=_("Mentions"), bookmarks=_("Bookmarks"), conversations=_("Conversations"), sent_toots=_("Sent toots"), favourites=_("Favorites"), followers=_("Followers"), following=_("Following"), blocked=_(u"Blocked users"), muted=_(u"Muted users")) if self.name in list(basic_buffers.keys()): return basic_buffers[self.name] # Check user timelines @@ -89,7 +89,7 @@ class BaseBuffer(base.Buffer): count = self.session.settings["general"]["max_toots_per_call"] min_id = None # toDo: Implement reverse timelines properly here. - if self.name != "favorites" and self.name in self.session.db and len(self.session.db[self.name]) > 0: + if (self.name != "favorites" and self.name != "bookmarks") and self.name in self.session.db and len(self.session.db[self.name]) > 0: min_id = self.session.db[self.name][-1].id try: results = getattr(self.session.api, self.function)(min_id=min_id, limit=count, *self.args, **self.kwargs) diff --git a/src/controller/mastodon/handler.py b/src/controller/mastodon/handler.py index 8e1ba7cc..1a197e4d 100644 --- a/src/controller/mastodon/handler.py +++ b/src/controller/mastodon/handler.py @@ -34,6 +34,8 @@ class Handler(object): # pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Sent tweets"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="user_timeline", name="sent_tweets", sessionObject=session, account=session.db["user_name"], screen_name=session.db["user_name"], include_ext_alt_text=True, tweet_mode="extended")) elif i == 'favorites': pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Favorites"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="favourites", name="favorites", sessionObject=session, account=session.db["user_name"], sound="favourite.ogg")) + elif i == 'bookmarks': + pub.sendMessage("createBuffer", buffer_type="BaseBuffer", session_type=session.type, buffer_title=_("Bookmarks"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="bookmarks", name="bookmarks", sessionObject=session, account=session.db["user_name"], sound="favourite.ogg")) # elif i == 'followers': # pub.sendMessage("createBuffer", buffer_type="PeopleBuffer", session_type=session.type, buffer_title=_("Followers"), parent_tab=root_position, start=False, kwargs=dict(parent=controller.view.nb, function="get_followers", name="followers", sessionObject=session, account=session.db["user_name"], sound="update_followers.ogg", screen_name=session.db["user_name"])) # elif i == 'friends':