[gnome-builder] libide/gtk: handle truncation items-changed more correctly



commit 5ae396b2cdaeac80d416e322bec6aa37541534ba
Author: Christian Hergert <chergert redhat com>
Date:   Tue Sep 20 17:04:00 2022 -0700

    libide/gtk: handle truncation items-changed more correctly

 src/libide/gtk/ide-truncate-model.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/libide/gtk/ide-truncate-model.c b/src/libide/gtk/ide-truncate-model.c
index 979ba2755..4cda9e882 100644
--- a/src/libide/gtk/ide-truncate-model.c
+++ b/src/libide/gtk/ide-truncate-model.c
@@ -120,10 +120,11 @@ ide_truncate_model_items_changed_cb (IdeTruncateModel *self,
     {
       if (position < (self->max_items - 1))
         {
-          g_list_model_items_changed (G_LIST_MODEL (self),
-                                      0,
-                                      self->prev_n_items,
-                                      MIN (n_items, self->max_items));
+          guint truncate_removed = MIN (self->prev_n_items, self->max_items);
+          guint truncate_added = MIN (n_items, self->max_items);
+
+          if (truncate_removed || truncate_added)
+            g_list_model_items_changed (G_LIST_MODEL (self), 0, truncate_removed, truncate_added);
         }
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]