[gnome-photos/wip/rishi/filter-freeze: 1/4] offset-controller: Prevent loading more items than there actually is



commit e37319b6447433b3d7749d92f0991e68b2a53a62
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Oct 7 17:04:32 2015 +0200

    offset-controller: Prevent loading more items than there actually is
    
    Earlier, we had code in LoadMoreButton that would stop us from trying
    to load more items that we actually had. We lost that when
    LoadMoreButton was killed.
    
    Since we no longer have all the code that looked at the vertical
    GtkAdjustment and item count to decide whether or not to show the
    button, we can directly bake this condition into
    photos_offset_controller_increase_offset.
    
    Fall out from 1d226d3d81a7ce0bda165bcc17f02ba540b70b24
    
    https://bugzilla.gnome.org/show_bug.cgi?id=688566

 src/photos-offset-controller.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-offset-controller.c b/src/photos-offset-controller.c
index b0fb042..7dd3fdf 100644
--- a/src/photos-offset-controller.c
+++ b/src/photos-offset-controller.c
@@ -196,6 +196,11 @@ void
 photos_offset_controller_increase_offset (PhotosOffsetController *self)
 {
   PhotosOffsetControllerPrivate *priv = self->priv;
+  gint remaining;
+
+  remaining = photos_offset_controller_get_remaining (self);
+  if (remaining <= 0)
+    return;
 
   priv->offset += OFFSET_STEP;
   g_signal_emit (self, signals[OFFSET_CHANGED], 0, priv->offset);


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