diff cagou/plugins/plugin_wid_chat.kv @ 394:d15828ca9d86

chat: use the new "implicit_update" and "to_show" properties for ChatSelector.jid_selector: - "implicit_update" is used to avoid double update on init - "to_show" is used to show opened chats, roster and bookmarks - update jid_selector when pre_entering the chat selector
author Goffi <goffi@goffi.org>
date Thu, 06 Feb 2020 21:16:21 +0100
parents e2f806779b53
children f7476818f9fb
line wrap: on
line diff
--- a/cagou/plugins/plugin_wid_chat.kv	Thu Feb 06 21:16:21 2020 +0100
+++ b/cagou/plugins/plugin_wid_chat.kv	Thu Feb 06 21:16:21 2020 +0100
@@ -20,13 +20,7 @@
 #:import SimpleXHTMLWidget cagou.core.simple_xhtml.SimpleXHTMLWidget
 #:import DelayedBoxLayout cagou.core.common_widgets.DelayedBoxLayout
 #:import ScrollEffect kivy.effects.scroll.ScrollEffect
-
-
-# Chat Selector
-
-<ChatSelector>:
-    JidSelector:
-        on_select: root.on_select(args[1])
+#:import CategorySeparator cagou.core.common_widgets.CategorySeparator
 
 
 # Chat
@@ -219,3 +213,24 @@
         Rectangle:
             pos: self.pos
             size: self.size
+
+
+# Chat Selector
+
+<ChatSelector>:
+    jid_selector: jid_selector
+    JidSelector:
+        id: jid_selector
+        # we call update() explicitly in on_pre_enter
+        implicit_update: False
+        on_select: root.on_select(args[1])
+        to_show:
+            [
+            CategorySeparator(text=_("Opened chats")),
+            "opened_chats",
+            CategorySeparator(text=_("Your contacts")),
+            "roster",
+            CategorySeparator(text=_("Your chat rooms")),
+            "bookmarks",
+            ]
+