[gtk] slice model: Don't report excessive changes



commit 045b92abddf10445f79dcf65e6864d5aa30ad2b6
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Jan 6 12:24:57 2019 -0500

    slice model: Don't report excessive changes
    
    We were not skipping an unchanged initial segment
    of the slice in some cases. Fix that.

 gtk/gtkslicelistmodel.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtkslicelistmodel.c b/gtk/gtkslicelistmodel.c
index 712e46ca68..753807fa6f 100644
--- a/gtk/gtkslicelistmodel.c
+++ b/gtk/gtkslicelistmodel.c
@@ -156,13 +156,19 @@ gtk_slice_list_model_items_changed_cb (GListModel        *model,
   else
     {
       guint n_after, n_before;
+      guint skip;
+
+      if (position > self->offset)
+        skip = position - self->offset;
+      else
+        skip = 0;
 
       n_after = g_list_model_get_n_items (self->model);
       n_before = n_after - added + removed;
       n_after = CLAMP (n_after, self->offset, self->offset + self->size) - self->offset;
       n_before = CLAMP (n_before, self->offset, self->offset + self->size) - self->offset;
 
-      g_list_model_items_changed (G_LIST_MODEL (self), 0, n_before, n_after);
+      g_list_model_items_changed (G_LIST_MODEL (self), skip, n_before - skip, n_after - skip);
     }
 }
 


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