Mercurial > libervia-desktop-kivy
changeset 388:de066b72f5a8
core: cache MUC bookmarks on startup
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 06 Feb 2020 21:16:21 +0100 |
parents | d61bbbac4160 |
children | 442756495a96 |
files | cagou/core/cagou_main.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/cagou/core/cagou_main.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/core/cagou_main.py Thu Feb 06 21:16:21 2020 +0100 @@ -20,6 +20,7 @@ import os.path import glob import sys +from functools import partial from sat.core.i18n import _ from . import kivy_hack kivy_hack.do_hack() @@ -514,10 +515,20 @@ del self.app._profile_manager super(Cagou, self).postInit(profile_manager) + def _bookmarksListCb(self, bookmarks_dict, profile): + bookmarks = set() + for data in bookmarks_dict.values(): + bookmarks.update({jid.JID(k) for k in data.keys()}) + self.profiles[profile]._bookmarks = sorted(bookmarks) + def profilePlugged(self, profile): super().profilePlugged(profile) # FIXME: this won't work with multiple profiles self.app.connected = self.profiles[profile].connected + self.bridge.bookmarksList( + "muc", "all", profile, + callback=partial(self._bookmarksListCb, profile=profile), + errback=partial(self.errback, title=_("Bookmark error"))) def _defaultFactoryMain(self, plugin_info, target, profiles): """default factory used to create main widgets instances