[gnome-photos/wip/flowbox] Try to use a GtkFlowBox



commit 7f4ee9a96bf39b58c796fb8d147b3897d622dda0
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Oct 18 18:33:14 2013 +0200

    Try to use a GtkFlowBox

 configure.ac                |    2 +-
 src/Makefile.am             |    2 +
 src/photos-flow-box.c       |  295 +++++++++++++++++++++++++++++++++++++++++++
 src/photos-flow-box.h       |   73 +++++++++++
 src/photos-view-container.c |  135 +++++++++++---------
 5 files changed, 444 insertions(+), 63 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2af074d..253b846 100644
--- a/configure.ac
+++ b/configure.ac
@@ -28,7 +28,7 @@ EXEMPI_MIN_VERSION=1.99.5
 GLIB_MIN_VERSION=2.35.1
 GOA_MIN_VERSION=3.8.0
 GRILO_MIN_VERSION=0.2.6
-GTK_MIN_VERSION=3.9.11
+GTK_MIN_VERSION=3.11.0
 LIBEXIF_MIN_VERSION=0.6.14
 LIBRSVG_MIN_VERSION=2.26.0
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 2cc64a3..4534fc3 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -98,6 +98,8 @@ gnome_photos_SOURCES = \
        photos-filterable.h \
        photos-flickr-item.c \
        photos-flickr-item.h \
+       photos-flow-box.c \
+       photos-flow-box.h \
        photos-header-bar.c \
        photos-header-bar.h \
        photos-indexing-notification.c \
diff --git a/src/photos-flow-box.c b/src/photos-flow-box.c
new file mode 100644
index 0000000..d8e27c2
--- /dev/null
+++ b/src/photos-flow-box.c
@@ -0,0 +1,295 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+
+#include "config.h"
+
+#include <glib.h>
+
+#include "photos-flow-box.h"
+#include "photos-view-model.h"
+
+
+struct _PhotosFlowBoxPrivate
+{
+  GtkTreeModel *model;
+};
+
+
+G_DEFINE_TYPE_WITH_PRIVATE (PhotosFlowBox, photos_flow_box, GTK_TYPE_FLOW_BOX);
+
+
+/* static void */
+/* photos_flow_box_save_geometry (PhotosFlowBox *self) */
+/* { */
+/*   PhotosFlowBoxPrivate *priv = self->priv; */
+/*   GVariant *variant; */
+/*   GdkWindow *window; */
+/*   GdkWindowState state; */
+/*   gint32 position[2]; */
+/*   gint32 size[2]; */
+
+/*   window = gtk_widget_get_window (GTK_WIDGET (self)); */
+/*   state = gdk_window_get_state (window); */
+/*   if (state & GDK_WINDOW_STATE_MAXIMIZED) */
+/*     return; */
+
+/*   gtk_window_get_size (GTK_WINDOW (self), (gint *) &size[0], (gint *) &size[1]); */
+/*   variant = g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, size, 2, sizeof (size[0])); */
+/*   g_settings_set_value (priv->settings, "window-size", variant); */
+
+/*   gtk_window_get_position (GTK_WINDOW (self), (gint *) &position[0], (gint *) &position[1]); */
+/*   variant = g_variant_new_fixed_array (G_VARIANT_TYPE_INT32, position, 2, sizeof (position[0])); */
+/*   g_settings_set_value (priv->settings, "window-position", variant); */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_configure_id_timeout (gpointer user_data) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (user_data); */
+
+/*   photos_flow_box_save_geometry (self); */
+/*   return G_SOURCE_REMOVE; */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_configure_event (GtkWidget *widget, GdkEventConfigure *event) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (widget); */
+/*   PhotosFlowBoxPrivate *priv = self->priv; */
+/*   gboolean ret_val; */
+
+/*   ret_val = GTK_WIDGET_CLASS (photos_flow_box_parent_class)->configure_event (widget, event); */
+
+/*   if (photos_mode_controller_get_fullscreen (priv->controller)) */
+/*     return ret_val; */
+
+/*   if (priv->configure_id != 0) */
+/*     { */
+/*       g_source_remove (priv->configure_id); */
+/*       priv->configure_id = 0; */
+/*     } */
+
+/*   priv->configure_id = g_timeout_add (CONFIGURE_ID_TIMEOUT, photos_flow_box_configure_id_timeout, self); 
*/
+/*   return ret_val; */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_delete_event (GtkWidget *widget, GdkEventAny *event) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (widget); */
+/*   PhotosFlowBoxPrivate *priv = self->priv; */
+
+/*   if (priv->configure_id != 0) */
+/*     { */
+/*       g_source_remove (priv->configure_id); */
+/*       priv->configure_id = 0; */
+/*     } */
+
+/*   photos_flow_box_save_geometry (self); */
+/*   return GDK_EVENT_PROPAGATE; */
+/* } */
+
+
+/* static void */
+/* photos_flow_box_fullscreen_changed (PhotosModeController *controller, gboolean fullscreen, gpointer 
user_data) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (user_data); */
+
+/*   if (fullscreen) */
+/*     gtk_window_fullscreen (GTK_WINDOW (self)); */
+/*   else */
+/*     gtk_window_unfullscreen (GTK_WINDOW (self)); */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_handle_key_overview (PhotosFlowBox *self, GdkEventKey *event) */
+/* { */
+/*   return GDK_EVENT_PROPAGATE; */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_handle_key_preview (PhotosFlowBox *self, GdkEventKey *event) */
+/* { */
+/*   PhotosFlowBoxPrivate *priv = self->priv; */
+/*   GtkTextDirection direction; */
+/*   gboolean fullscreen; */
+
+/*   direction = gtk_widget_get_direction (GTK_WIDGET (self)); */
+/*   fullscreen = photos_mode_controller_get_fullscreen (priv->controller); */
+
+/*   if ((fullscreen && event->keyval == GDK_KEY_Escape) */
+/*       || ((event->state & GDK_MOD1_MASK) != 0 */
+/*           && ((direction == GTK_TEXT_DIR_LTR && event->keyval == GDK_KEY_Left) */
+/*               || (direction == GTK_TEXT_DIR_RTL && event->keyval == GDK_KEY_Right))) */
+/*       || event->keyval == GDK_KEY_BackSpace */
+/*       || event->keyval == GDK_KEY_Back) */
+/*     { */
+/*       photos_base_manager_set_active_object (priv->item_mngr, NULL); */
+/*       return GDK_EVENT_STOP; */
+/*     } */
+
+/*   return GDK_EVENT_PROPAGATE; */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_key_press_event (GtkWidget *widget, GdkEventKey *event) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (widget); */
+/*   PhotosFlowBoxPrivate *priv = self->priv; */
+/*   PhotosWindowMode mode; */
+/*   gboolean handled; */
+
+/*   mode = photos_mode_controller_get_window_mode (priv->controller); */
+/*   if (mode == PHOTOS_WINDOW_MODE_PREVIEW) */
+/*     handled = photos_flow_box_handle_key_preview (self, event); */
+/*   else */
+/*     handled = photos_flow_box_handle_key_overview (self, event); */
+
+/*   if (!handled) */
+/*     handled = GTK_WIDGET_CLASS (photos_flow_box_parent_class)->key_press_event (widget, event); */
+
+/*   return handled; */
+/* } */
+
+
+/* static gboolean */
+/* photos_flow_box_window_state_event (GtkWidget *widget, GdkEventWindowState *event) */
+/* { */
+/*   PhotosFlowBox *self = PHOTOS_FLOW_BOX (widget); */
+/*   GdkWindow *window; */
+/*   GdkWindowState state; */
+/*   gboolean maximized; */
+/*   gboolean ret_val; */
+
+/*   ret_val = GTK_WIDGET_CLASS (photos_flow_box_parent_class)->window_state_event (widget, event); */
+
+/*   window = gtk_widget_get_window (widget); */
+/*   state = gdk_window_get_state (window); */
+
+/*   if (state & GDK_WINDOW_STATE_FULLSCREEN) */
+/*     return ret_val; */
+
+/*   maximized = (state & GDK_WINDOW_STATE_MAXIMIZED); */
+/*   g_settings_set_boolean (self->priv->settings, "window-maximized", maximized); */
+
+/*   return ret_val; */
+/* } */
+
+
+static void
+photos_flow_box_dispose (GObject *object)
+{
+  PhotosFlowBox *self = PHOTOS_FLOW_BOX (object);
+  PhotosFlowBoxPrivate *priv = self->priv;
+
+  g_clear_object (&priv->model);
+
+  G_OBJECT_CLASS (photos_flow_box_parent_class)->dispose (object);
+}
+
+
+static void
+photos_flow_box_init (PhotosFlowBox *self)
+{
+  PhotosFlowBoxPrivate *priv;
+
+  self->priv = photos_flow_box_get_instance_private (self);
+  priv = self->priv;
+}
+
+
+static void
+photos_flow_box_class_init (PhotosFlowBoxClass *class)
+{
+  GObjectClass *object_class = G_OBJECT_CLASS (class);
+  GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+
+  object_class->dispose = photos_flow_box_dispose;
+  /* widget_class->configure_event = photos_flow_box_configure_event; */
+  /* widget_class->delete_event = photos_flow_box_delete_event; */
+  /* widget_class->key_press_event = photos_flow_box_key_press_event; */
+  /* widget_class->window_state_event = photos_flow_box_window_state_event; */
+}
+
+
+GtkWidget *
+photos_flow_box_new (void)
+{
+  return g_object_new (PHOTOS_TYPE_FLOW_BOX,
+                       "homogeneous", TRUE,
+                       "min-children-per-line", 2,
+                       NULL);
+}
+
+
+void
+photos_flow_box_set_model (PhotosFlowBox *self, GtkTreeModel *model)
+{
+  PhotosFlowBoxPrivate *priv = self->priv;
+  GList *children = NULL;
+  GList *l;
+  GtkTreeIter iter;
+
+  if (priv->model == model)
+    goto out;
+
+  g_clear_object (&priv->model);
+  children = gtk_container_get_children (GTK_CONTAINER (self));
+  for (l = children; l != NULL; l = l->next)
+    {
+      GtkWidget *child = GTK_WIDGET (l->data);
+      gtk_container_remove (GTK_CONTAINER (self), child);
+    }
+
+  if (model == NULL)
+    goto out;
+
+  priv->model = g_object_ref (model);
+  if (!gtk_tree_model_get_iter_first (priv->model, &iter))
+    goto out;
+
+  do
+    {
+      GdkPixbuf *pixbuf;
+      GtkWidget *child;
+      GtkWidget *image;
+
+      child = gtk_flow_box_child_new ();
+      gtk_container_add (GTK_CONTAINER (self), child);
+
+      gtk_tree_model_get (model, &iter, PHOTOS_VIEW_MODEL_ICON, &pixbuf, -1);
+
+      image = gtk_image_new_from_pixbuf (pixbuf);
+      gtk_container_add (GTK_CONTAINER (child), image);
+
+      gtk_widget_show_all (child);
+      g_clear_object (&pixbuf);
+    } while (gtk_tree_model_iter_next (model, &iter));
+
+ out:
+  g_list_free (children);
+}
diff --git a/src/photos-flow-box.h b/src/photos-flow-box.h
new file mode 100644
index 0000000..6599421
--- /dev/null
+++ b/src/photos-flow-box.h
@@ -0,0 +1,73 @@
+/*
+ * Photos - access, organize and share your photos on GNOME
+ * Copyright © 2013 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+#ifndef PHOTOS_FLOW_BOX_H
+#define PHOTOS_FLOW_BOX_H
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PHOTOS_TYPE_FLOW_BOX (photos_flow_box_get_type ())
+
+#define PHOTOS_FLOW_BOX(obj) \
+  (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+   PHOTOS_TYPE_FLOW_BOX, PhotosFlowBox))
+
+#define PHOTOS_FLOW_BOX_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_CAST ((klass), \
+   PHOTOS_TYPE_FLOW_BOX, PhotosFlowBoxClass))
+
+#define PHOTOS_IS_FLOW_BOX(obj) \
+  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+   PHOTOS_TYPE_FLOW_BOX))
+
+#define PHOTOS_IS_FLOW_BOX_CLASS(klass) \
+  (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+   PHOTOS_TYPE_FLOW_BOX))
+
+#define PHOTOS_FLOW_BOX_GET_CLASS(obj) \
+  (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+   PHOTOS_TYPE_FLOW_BOX, PhotosFlowBoxClass))
+
+typedef struct _PhotosFlowBox        PhotosFlowBox;
+typedef struct _PhotosFlowBoxClass   PhotosFlowBoxClass;
+typedef struct _PhotosFlowBoxPrivate PhotosFlowBoxPrivate;
+
+struct _PhotosFlowBox
+{
+  GtkFlowBox parent_instance;
+  PhotosFlowBoxPrivate *priv;
+};
+
+struct _PhotosFlowBoxClass
+{
+  GtkFlowBoxClass parent_class;
+};
+
+GType                  photos_flow_box_get_type               (void) G_GNUC_CONST;
+
+GtkWidget             *photos_flow_box_new                    (void);
+
+void                   photos_flow_box_set_model              (PhotosFlowBox *self, GtkTreeModel *model);
+
+G_END_DECLS
+
+#endif /* PHOTOS_FLOW_BOX_H */
diff --git a/src/photos-view-container.c b/src/photos-view-container.c
index c398c91..3828e03 100644
--- a/src/photos-view-container.c
+++ b/src/photos-view-container.c
@@ -24,10 +24,10 @@
 
 
 #include "config.h"
-#include <libgd/gd.h>
 
 #include "photos-application.h"
 #include "photos-enums.h"
+#include "photos-flow-box.h"
 #include "photos-item-manager.h"
 #include "photos-load-more-button.h"
 #include "photos-remote-display-manager.h"
@@ -42,10 +42,11 @@
 
 struct _PhotosViewContainerPrivate
 {
-  GdMainView *view;
   GtkListStore *model;
   GtkTreePath *current_path;
   GtkWidget *load_more;
+  GtkWidget *sw;
+  GtkWidget *view;
   PhotosBaseManager *item_mngr;
   PhotosModeController *mode_cntrlr;
   PhotosRemoteDisplayManager *remote_mngr;
@@ -77,14 +78,14 @@ photos_view_container_view_changed (PhotosViewContainer *self)
   gdouble value;
   gint reveal_area_height = 32;
 
-  vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->view));
+  vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->sw));
   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));
+  vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->sw));
   page_size = gtk_adjustment_get_page_size (vadjustment);
   upper = gtk_adjustment_get_upper (vadjustment);
   value = gtk_adjustment_get_value (vadjustment);
@@ -106,7 +107,7 @@ photos_view_container_connect_view (PhotosViewContainer *self)
   GtkAdjustment *vadjustment;
   GtkWidget *vscrollbar;
 
-  vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->view));
+  vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->sw));
   g_signal_connect_object (vadjustment,
                            "changed",
                            G_CALLBACK (photos_view_container_view_changed),
@@ -118,7 +119,7 @@ photos_view_container_connect_view (PhotosViewContainer *self)
                            self,
                            G_CONNECT_SWAPPED);
 
-  vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->view));
+  vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->sw));
   g_signal_connect_object (vscrollbar,
                            "notify::visible",
                            G_CALLBACK (photos_view_container_view_changed),
@@ -136,33 +137,33 @@ photos_view_container_disconnect_view (PhotosViewContainer *self)
   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));
+  vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->sw));
+  vscrollbar = gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW (priv->sw));
 
   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);
 }
 
 
-static void
-photos_view_container_item_activated (GdMainView *main_view,
-                                      const gchar * id,
-                                      const GtkTreePath *path,
-                                      gpointer user_data)
-{
-  PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data);
-  PhotosViewContainerPrivate *priv = self->priv;
-  GObject *object;
+/* static void */
+/* photos_view_container_item_activated (GdMainView *main_view, */
+/*                                       const gchar * id, */
+/*                                       const GtkTreePath *path, */
+/*                                       gpointer user_data) */
+/* { */
+/*   PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data); */
+/*   PhotosViewContainerPrivate *priv = self->priv; */
+/*   GObject *object; */
 
-  priv->current_path = gtk_tree_path_copy (path);
-  object = photos_base_manager_get_object_by_id (priv->item_mngr, id);
+/*   priv->current_path = gtk_tree_path_copy (path); */
+/*   object = photos_base_manager_get_object_by_id (priv->item_mngr, id); */
 
-  if (!photos_base_item_is_collection (PHOTOS_BASE_ITEM (object)) &&
-      photos_remote_display_manager_is_active (priv->remote_mngr))
-    photos_remote_display_manager_render (priv->remote_mngr, PHOTOS_BASE_ITEM (object));
-  else
-    photos_base_manager_set_active_object (priv->item_mngr, object);
-}
+/*   if (!photos_base_item_is_collection (PHOTOS_BASE_ITEM (object)) && */
+/*       photos_remote_display_manager_is_active (priv->remote_mngr)) */
+/*     photos_remote_display_manager_render (priv->remote_mngr, PHOTOS_BASE_ITEM (object)); */
+/*   else */
+/*     photos_base_manager_set_active_object (priv->item_mngr, object); */
+/* } */
 
 
 static void
@@ -175,14 +176,14 @@ photos_view_container_query_status_changed (PhotosTrackerController *trk_cntrlr,
 
   if (!query_status)
     {
-      gd_main_view_set_model (priv->view, GTK_TREE_MODEL (priv->model));
+      photos_flow_box_set_model (PHOTOS_FLOW_BOX (priv->view), GTK_TREE_MODEL (priv->model));
       photos_selection_controller_freeze_selection (priv->sel_cntrlr, FALSE);
       /* TODO: update selection */
     }
   else
     {
       photos_selection_controller_freeze_selection (priv->sel_cntrlr, TRUE);
-      gd_main_view_set_model (priv->view, NULL);
+      photos_flow_box_set_model (PHOTOS_FLOW_BOX (priv->view), NULL);
     }
 }
 
@@ -193,33 +194,33 @@ photos_view_container_selection_mode_changed (PhotosSelectionController *sel_cnt
                                               gpointer user_data)
 {
   PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data);
-  gd_main_view_set_selection_mode (self->priv->view, mode);
+  /* gd_main_view_set_selection_mode (self->priv->view, mode); */
 }
 
 
-static void
-photos_view_container_selection_mode_request (GdMainView *main_view, gpointer user_data)
-{
-  PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data);
-  photos_selection_controller_set_selection_mode (self->priv->sel_cntrlr, TRUE);
-}
+/* static void */
+/* photos_view_container_selection_mode_request (GdMainView *main_view, gpointer user_data) */
+/* { */
+/*   PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data); */
+/*   photos_selection_controller_set_selection_mode (self->priv->sel_cntrlr, TRUE); */
+/* } */
 
 
-static void
-photos_view_container_view_selection_changed (GdMainView *main_view, gpointer user_data)
-{
-  PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data);
-  PhotosViewContainerPrivate *priv = self->priv;
-  GList *selected_urns;
-  GList *selection;
+/* static void */
+/* photos_view_container_view_selection_changed (GdMainView *main_view, gpointer user_data) */
+/* { */
+/*   PhotosViewContainer *self = PHOTOS_VIEW_CONTAINER (user_data); */
+/*   PhotosViewContainerPrivate *priv = self->priv; */
+/*   GList *selected_urns; */
+/*   GList *selection; */
 
-  selection = gd_main_view_get_selection (main_view);
-  selected_urns = photos_utils_get_urns_from_paths (selection, GTK_TREE_MODEL (priv->model));
-  photos_selection_controller_set_selection (priv->sel_cntrlr, selected_urns);
+/*   selection = gd_main_view_get_selection (main_view); */
+/*   selected_urns = photos_utils_get_urns_from_paths (selection, GTK_TREE_MODEL (priv->model)); */
+/*   photos_selection_controller_set_selection (priv->sel_cntrlr, selected_urns); */
 
-  if (selection != NULL)
-    g_list_free_full (selection, (GDestroyNotify) gtk_tree_path_free);
-}
+/*   if (selection != NULL) */
+/*     g_list_free_full (selection, (GDestroyNotify) gtk_tree_path_free); */
+/* } */
 
 
 static void
@@ -246,6 +247,7 @@ photos_view_container_constructed (GObject *object)
   PhotosViewContainerPrivate *priv = self->priv;
   GAction *action;
   GtkApplication *app;
+  GtkStyleContext *context;
   gboolean status;
 
   G_OBJECT_CLASS (photos_view_container_parent_class)->constructed (object);
@@ -254,23 +256,32 @@ photos_view_container_constructed (GObject *object)
 
   gtk_orientable_set_orientation (GTK_ORIENTABLE (self), GTK_ORIENTATION_VERTICAL);
 
-  priv->view = gd_main_view_new (GD_MAIN_VIEW_ICON);
-  gtk_container_add (GTK_CONTAINER (self), GTK_WIDGET (priv->view));
+  priv->sw = gtk_scrolled_window_new (NULL, NULL);
+  gtk_widget_set_hexpand (priv->sw, TRUE);
+  gtk_widget_set_vexpand (priv->sw, TRUE);
+  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (priv->sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
+  gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (priv->sw), GTK_SHADOW_IN);
+  context = gtk_widget_get_style_context (priv->sw);
+  gtk_style_context_add_class (context, "documents-scrolledwin");
+  gtk_container_add (GTK_CONTAINER (self), priv->sw);
+
+  priv->view = photos_flow_box_new ();
+  gtk_container_add (GTK_CONTAINER (priv->sw), priv->view);
 
   priv->load_more = photos_load_more_button_new (priv->mode);
   gtk_container_add (GTK_CONTAINER (self), priv->load_more);
 
   gtk_widget_show_all (GTK_WIDGET (self));
 
-  g_signal_connect (priv->view, "item-activated", G_CALLBACK (photos_view_container_item_activated), self);
-  g_signal_connect (priv->view,
-                    "selection-mode-request",
-                    G_CALLBACK (photos_view_container_selection_mode_request),
-                    self);
-  g_signal_connect (priv->view,
-                    "view-selection-changed",
-                    G_CALLBACK (photos_view_container_view_selection_changed),
-                    self);
+  /* g_signal_connect (priv->view, "item-activated", G_CALLBACK (photos_view_container_item_activated), 
self); */
+  /* g_signal_connect (priv->view, */
+  /*                   "selection-mode-request", */
+  /*                   G_CALLBACK (photos_view_container_selection_mode_request), */
+  /*                   self); */
+  /* g_signal_connect (priv->view, */
+  /*                   "view-selection-changed", */
+  /*                   G_CALLBACK (photos_view_container_view_selection_changed), */
+  /*                   self); */
 
   priv->item_mngr = photos_item_manager_dup_singleton ();
 
@@ -312,11 +323,11 @@ photos_view_container_constructed (GObject *object)
 
   app = photos_application_new ();
 
-  action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-all");
-  g_signal_connect_swapped (action, "activate", G_CALLBACK (gd_main_view_select_all), priv->view);
+  /* action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-all"); */
+  /* g_signal_connect_swapped (action, "activate", G_CALLBACK (gd_main_view_select_all), priv->view); */
 
-  action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-none");
-  g_signal_connect_swapped (action, "activate", G_CALLBACK (gd_main_view_unselect_all), priv->view);
+  /* action = g_action_map_lookup_action (G_ACTION_MAP (app), "select-none"); */
+  /* g_signal_connect_swapped (action, "activate", G_CALLBACK (gd_main_view_unselect_all), priv->view); */
 
   g_object_unref (app);
 


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