After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 688566 - Replace "Load More" button with edge hit detection
Replace "Load More" button with edge hit detection
Status: RESOLVED FIXED
Product: gnome-photos
Classification: Applications
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: GNOME photos maintainer(s)
GNOME photos maintainer(s)
: 690257 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-11-18 01:35 UTC by William Jon McCann
Modified: 2015-10-09 11:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
view-container: Replace "Load More" button with edge hit detection (16.32 KB, patch)
2015-01-02 20:01 UTC, Pranav Kant
needs-work Details | Review
view-container: Replace "Load More" button with edge hit detection (16.21 KB, patch)
2015-01-05 17:52 UTC, Debarshi Ray
committed Details | Review
view-container: code cleanup (2.55 KB, patch)
2015-01-05 18:24 UTC, Pranav Kant
needs-work Details | Review
view-container: Clean up (1.29 KB, patch)
2015-01-06 12:29 UTC, Pranav Kant
needs-work Details | Review
clean up (1.34 KB, patch)
2015-01-06 16:44 UTC, Pranav Kant
committed Details | Review
offset-controller: Prevent loading more items than there actually is (1.35 KB, patch)
2015-10-07 15:07 UTC, Debarshi Ray
committed Details | Review

Description William Jon McCann 2012-11-18 01:35:29 UTC
The load more button pops in abruptly when I scroll to the bottom of the view. I think it should just be sitting at the bottom of view all the time and then when I scroll down enough it will just be there.
Comment 1 Debarshi Ray 2013-08-09 14:29:00 UTC
Retitling to include other similar complaints about the button.
Comment 2 Debarshi Ray 2013-08-09 14:29:35 UTC
Bug 690257 suggests that it should be part of the list instead of being a button at the bottom of the list.
Comment 3 Debarshi Ray 2013-08-09 14:30:39 UTC
*** Bug 690257 has been marked as a duplicate of this bug. ***
Comment 4 Debarshi Ray 2014-12-16 12:02:51 UTC
We should be using GtkScrolledWindow::edge-overshot. See 738881
Comment 5 Pranav Kant 2015-01-02 20:01:06 UTC
Created attachment 293617 [details] [review]
view-container: Replace "Load More" button with edge hit detection
Comment 6 Debarshi Ray 2015-01-05 17:51:48 UTC
Review of attachment 293617 [details] [review]:

Thanks for the patch, Pranav. Looks good except a few minor niggles.

::: src/photos-view-container.c
@@ +78,3 @@
 static void
+photos_view_container_view_changed (PhotosViewContainer *self,
+                                    GtkPositionType pos)

This should be on the same line.

@@ +81,2 @@
 {
   PhotosViewContainerPrivate *priv = self->priv;

We can remove this because we are using priv in only one place.

@@ +90,3 @@
 photos_view_container_connect_view (PhotosViewContainer *self)
 {
   PhotosViewContainerPrivate *priv = self->priv;

Ditto.
Comment 7 Debarshi Ray 2015-01-05 17:52:34 UTC
Created attachment 293864 [details] [review]
view-container: Replace "Load More" button with edge hit detection

I took the liberty to fix the above issues and committed it. Thanks again.
Comment 8 Pranav Kant 2015-01-05 18:24:29 UTC
Created attachment 293866 [details] [review]
view-container: code cleanup

Use g_signal_connect_swapped instead of g_signal_connect_object
Comment 9 Debarshi Ray 2015-01-05 21:26:19 UTC
Review of attachment 293866 [details] [review]:

Thanks for working on this, Pranav.

The commit message should be tweaked a bit. We usually use a capital letter after the ':' and it should be "view-container: Clean up" to match other similar commits.

Other than that, it would be good to explain why g_signal_connect_swapped is enough. It is obvious from reading the patch that we are replacing g_signal_connect_object with g_signal_connect_swapped, so there is no need to repeat that. The actual reason is not so obvious, especially because we chose to introduce g_signal_connect_object in a previous commit.

::: src/photos-view-container.c
@@ +336,3 @@
+                            "count-changed",
+                            G_CALLBACK (photos_view_container_count_changed),
+                            self);

This one should still be g_signal_connect_object because priv->offset_cntrlr can out live the PhotosViewContainer instance (ie. self) because PhotosOffsetControllers are global and will be alive as long as any object holds a reference to it. So, we need to use g_signal_connect_object to make sure that self does not continue to receive 'count-changed' emissions after it has been destroyed. Otherwise photos_view_container_count_changed will be invoked with an invalid self pointer.

@@ +341,3 @@
+                            "query-error",
+                            G_CALLBACK (photos_view_container_query_error),
+                            self);

Ditto.
Comment 10 Pranav Kant 2015-01-06 12:29:22 UTC
Created attachment 293914 [details] [review]
view-container: Clean up
Comment 11 Debarshi Ray 2015-01-06 13:06:46 UTC
Review of attachment 293914 [details] [review]:

Perfect. Just add the URL to the bug in the commit message before pushing.
Comment 12 Debarshi Ray 2015-01-06 16:29:45 UTC
Review of attachment 293914 [details] [review]:

Just noticed that the commit message is more than 72 characters long. See https://wiki.gnome.org/Git/CommitMessages
Comment 13 Pranav Kant 2015-01-06 16:44:49 UTC
Created attachment 293950 [details] [review]
clean up

Fixed the length of the commit message.
Comment 14 Debarshi Ray 2015-01-06 17:09:37 UTC
Review of attachment 293950 [details] [review]:

Looks good.
Comment 15 Debarshi Ray 2015-10-07 15:07:14 UTC
Review of attachment 293864 [details] [review]:

There is one bug that I failed to notice:

::: src/photos-load-more-button.c
@@ -66,3 @@
-  remaining = photos_offset_controller_get_remaining (priv->offset_cntrlr);
-  visible = !(remaining <= 0 || priv->block);
-  gtk_widget_set_visible (GTK_WIDGET (self), visible);

We have now lost this logic that prevented us from jumping off the edge. It is now possible to try to load more items than there is (and if you do that you get an empty view)
Comment 16 Debarshi Ray 2015-10-07 15:07:57 UTC
Created attachment 312834 [details] [review]
offset-controller: Prevent loading more items than there actually is
Comment 17 Alessandro Bono 2015-10-07 15:19:15 UTC
Review of attachment 312834 [details] [review]:

It makes sense to me.
Comment 18 Debarshi Ray 2015-10-09 11:15:09 UTC
(In reply to Debarshi Ray from comment #15)
> We have now lost this logic that prevented us from jumping off the edge. It
> is now possible to try to load more items than there is (and if you do that
> you get an empty view)

I was wrong about getting an empty view. That was caused by an unrelated change sitting in my tree, but we were still issuing two needless queries (one to get the items and one to count them), and it is always good to avoid those.