Daniel Brötzmann pushed to branch master at gajim / gajim


Commits:
75c572e1 by wurstsalat at 2021-12-13T23:56:41+01:00
BaseControl: Load messages via initial message fetch

ScrolledView adjustment changes are not reliable for initial message
fetching. Instead, we do an initial message fetch when activating the Control.

- - - - -


2 changed files:

- gajim/gtk/controls/base.py
- gajim/gtk/conversation/scrolled.py


Changes:

=====================================
gajim/gtk/controls/base.py
=====================================
@@ -225,6 +225,9 @@ def __init__(self, widget_name: str, account: str, jid: 
JID) -> None:
 
         self.xml.hbox.pack_start(self.msg_scrolledwindow, True, True, 0)
 
+        # Used for initial message row fetching in ConversationView
+        self._initial_fetch_finished: bool = False
+
         # the following vars are used to keep history of user's messages
         self.sent_history: List[str] = []
         self.sent_history_pos: int = 0
@@ -1312,6 +1315,10 @@ def update_text_tags(self):
         self.conversation_view.update_text_tags()
 
     def set_control_active(self, state: bool) -> None:
+        if not self._initial_fetch_finished:
+            self.fetch_n_lines_history(self._scrolled_view, True, 20)
+            self._initial_fetch_finished = True
+
         if state:
             self.set_emoticon_popover()
 


=====================================
gajim/gtk/conversation/scrolled.py
=====================================
@@ -111,12 +111,10 @@ def _on_adj_upper_changed(self,
                 if self._requesting == 'before':
                     adj.set_value(adj.get_value() + diff)
 
-        if upper == adj.get_page_size():
-            # There is no scrollbar, request history until there is
-            self.emit('request-history', True)
-            self._lower_complete = True
-            self._autoscroll = True
-            self.emit('autoscroll-changed', self._autoscroll)
+        self._lower_complete = True
+        self._autoscroll = True
+        self.emit('autoscroll-changed', self._autoscroll)
+
         self._requesting = None
 
     def _on_adj_value_changed(self,



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/75c572e18ddf2608ae68eff8df089fd16efb34ac

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/75c572e18ddf2608ae68eff8df089fd16efb34ac
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to