Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Hörist <philipp@hoerist.com>2023-10-03 00:11:43 +0300
committerPhilipp Hörist <philipp@hoerist.com>2023-10-03 00:11:43 +0300
commit03590b3b75fad55d377135e4759cde96138d85aa (patch)
tree7df20c9a3b249bcdf6fa784c6594b52b60ad3073
parentc2bbe7c287a398f3819773c01e7e7d569c991da2 (diff)
perf: View: Reset view faster
-rw-r--r--gajim/gtk/conversation/view.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/gajim/gtk/conversation/view.py b/gajim/gtk/conversation/view.py
index 15b567659..d7cc32dff 100644
--- a/gajim/gtk/conversation/view.py
+++ b/gajim/gtk/conversation/view.py
@@ -101,13 +101,11 @@ class ConversationView(Gtk.ScrolledWindow):
# horizontally under certain conditions (applies to GroupchatControl)
self.get_hscrollbar().hide()
- self._list_box = Gtk.ListBox()
- self._list_box.set_selection_mode(Gtk.SelectionMode.NONE)
- self._list_box.set_sort_func(self._sort_func)
-
self._contact: ChatContactT | None = None
self._client = None
+ self._list_box = Gtk.ListBox()
+
# Keeps track of the number of rows shown in ConversationView
self._row_count: int = 0
self._max_row_count: int = 100
@@ -254,6 +252,18 @@ class ConversationView(Gtk.ScrolledWindow):
log.debug('emit %s, %s', signal_name, args)
self.emit(signal_name, *args)
+ def _reset_list_box(self) -> None:
+ self._list_box.destroy()
+ self._list_box = Gtk.ListBox()
+ self._list_box.set_selection_mode(Gtk.SelectionMode.NONE)
+ self._list_box.set_sort_func(self._sort_func)
+ self._list_box.show()
+
+ current_child = self.get_child()
+ assert current_child is not None
+ current_child.destroy()
+ self.add(self._list_box)
+
def _reset(self) -> None:
self._current_upper = 0
self._autoscroll = True
@@ -263,8 +273,7 @@ class ConversationView(Gtk.ScrolledWindow):
self._requesting = None
self.set_history_complete(True, False)
- for row in self._list_box.get_children():
- row.destroy()
+ self._reset_list_box()
self._row_count = 0
self._active_date_rows = set()