[gnome-photos] view-container: Replace "Load More" button with edge hit detection
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] view-container: Replace "Load More" button with edge hit detection
- Date: Mon, 5 Jan 2015 17:52:44 +0000 (UTC)
commit 1d226d3d81a7ce0bda165bcc17f02ba540b70b24
Author: Pranav Kant <pranavk src gnome org>
Date: Sat Jan 3 01:28:05 2015 +0530
view-container: Replace "Load More" button with edge hit detection
https://bugzilla.gnome.org/show_bug.cgi?id=688566
configure.ac | 2 +-
po/POTFILES.in | 1 -
src/Makefile.am | 2 -
src/photos-load-more-button.c | 236 -----------------------------------------
src/photos-load-more-button.h | 79 --------------
src/photos-view-container.c | 68 +-----------
6 files changed, 7 insertions(+), 381 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b5196d6..bde97ad 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ GFBGRAPH_MIN_VERSION=0.2.1
GLIB_MIN_VERSION=2.39.3
GOA_MIN_VERSION=3.8.0
GRILO_MIN_VERSION=0.2.6
-GTK_MIN_VERSION=3.14.0
+GTK_MIN_VERSION=3.15.0
LIBEXIF_MIN_VERSION=0.6.14
LIBRSVG_MIN_VERSION=2.26.0
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d739667..ee048bd 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -20,7 +20,6 @@ src/photos-fetch-metas-job.c
src/photos-flickr-item.c
src/photos-google-item.c
src/photos-indexing-notification.c
-src/photos-load-more-button.c
src/photos-local-item.c
src/photos-main-toolbar.c
src/photos-main-window.c
diff --git a/src/Makefile.am b/src/Makefile.am
index 3888c5c..9ecf02c 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -125,8 +125,6 @@ gnome_photos_SOURCES = \
photos-indexing-notification.h \
photos-item-manager.c \
photos-item-manager.h \
- photos-load-more-button.c \
- photos-load-more-button.h \
photos-local-item.c \
photos-local-item.h \
photos-main-toolbar.c \
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index 186debb..cc3ea4e 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -30,7 +30,6 @@
#include "photos-enums.h"
#include "photos-error-box.h"
#include "photos-item-manager.h"
-#include "photos-load-more-button.h"
#include "photos-offset-favorites-controller.h"
#include "photos-offset-collections-controller.h"
#include "photos-offset-overview-controller.h"
@@ -53,7 +52,6 @@ struct _PhotosViewContainerPrivate
GtkListStore *model;
GtkTreePath *current_path;
GtkWidget *error_box;
- GtkWidget *load_more;
GtkWidget *no_results;
PhotosBaseManager *item_mngr;
PhotosModeController *mode_cntrlr;
@@ -78,66 +76,21 @@ G_DEFINE_TYPE_WITH_PRIVATE (PhotosViewContainer, photos_view_container, GTK_TYPE
static void
-photos_view_container_view_changed (PhotosViewContainer *self)
+photos_view_container_view_changed (PhotosViewContainer *self, GtkPositionType pos)
{
- PhotosViewContainerPrivate *priv = self->priv;
- GtkAdjustment *vadjustment;
- GtkWidget *vscrollbar;
- gboolean end = FALSE;
- gdouble page_size;
- gdouble upper;
- gdouble value;
- gint reveal_area_height = 32;
-
- vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->view));
- if (vscrollbar == NULL || !gtk_widget_get_visible (GTK_WIDGET (vscrollbar)))
- {
- photos_load_more_button_set_block (PHOTOS_LOAD_MORE_BUTTON (priv->load_more), TRUE);
- return;
- }
-
- vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->view));
- page_size = gtk_adjustment_get_page_size (vadjustment);
- upper = gtk_adjustment_get_upper (vadjustment);
- value = gtk_adjustment_get_value (vadjustment);
-
- /* Special case these values which happen at construction */
- if ((gint) value == 0 && (gint) upper == 1 && (gint) page_size == 1)
- end = FALSE;
- else
- end = !(value < (upper - page_size - reveal_area_height));
-
- photos_load_more_button_set_block (PHOTOS_LOAD_MORE_BUTTON (priv->load_more), !end);
+ if (pos == GTK_POS_BOTTOM)
+ photos_offset_controller_increase_offset (self->priv->offset_cntrlr);
}
static void
photos_view_container_connect_view (PhotosViewContainer *self)
{
- PhotosViewContainerPrivate *priv = self->priv;
- GtkAdjustment *vadjustment;
- GtkWidget *vscrollbar;
-
- vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->view));
- g_signal_connect_object (vadjustment,
- "changed",
+ g_signal_connect_object (self->priv->view,
+ "edge-overshot",
G_CALLBACK (photos_view_container_view_changed),
self,
G_CONNECT_SWAPPED);
- g_signal_connect_object (vadjustment,
- "value-changed",
- G_CALLBACK (photos_view_container_view_changed),
- self,
- G_CONNECT_SWAPPED);
-
- vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->view));
- g_signal_connect_object (vscrollbar,
- "notify::visible",
- G_CALLBACK (photos_view_container_view_changed),
- self,
- G_CONNECT_SWAPPED);
-
- photos_view_container_view_changed (self);
}
@@ -155,14 +108,8 @@ static void
photos_view_container_disconnect_view (PhotosViewContainer *self)
{
PhotosViewContainerPrivate *priv = self->priv;
- GtkAdjustment *vadjustment;
- GtkWidget *vscrollbar;
- vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->view));
- vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->view));
-
- g_signal_handlers_disconnect_by_func (vadjustment, photos_view_container_view_changed, self);
- g_signal_handlers_disconnect_by_func (vscrollbar, photos_view_container_view_changed, self);
+ g_signal_handlers_disconnect_by_func (priv->view, photos_view_container_view_changed, self);
}
@@ -320,9 +267,6 @@ photos_view_container_constructed (GObject *object)
gtk_icon_view_set_item_width (GTK_ICON_VIEW (generic_view), size + 24);
gtk_container_add (GTK_CONTAINER (grid), GTK_WIDGET (priv->view));
- priv->load_more = photos_load_more_button_new (priv->mode);
- gtk_container_add (GTK_CONTAINER (grid), priv->load_more);
-
gtk_widget_show_all (GTK_WIDGET (self));
gtk_stack_set_visible_child_full (GTK_STACK (self), "view", GTK_STACK_TRANSITION_TYPE_NONE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]