[gnome-photos/wip/rishi/edit-mode: 21/22] preview-view: Use EditPalette for showing the editing controls



commit 4f49d6a77ca2891394ca82e54dca43175b6186e8
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Jun 1 08:38:48 2015 +0200

    preview-view: Use EditPalette for showing the editing controls

 src/photos-preview-view.c |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 914d2de..95d97f2 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -32,6 +32,7 @@
 #include "gegl-gtk-view.h"
 #include "photos-base-item.h"
 #include "photos-base-manager.h"
+#include "photos-edit-palette.h"
 #include "photos-mode-controller.h"
 #include "photos-operation-insta-common.h"
 #include "photos-preview-nav-buttons.h"
@@ -43,6 +44,7 @@ struct _PhotosPreviewViewPrivate
 {
   GeglNode *node;
   GtkWidget *overlay;
+  GtkWidget *revealer;
   GtkWidget *stack;
   GtkWidget *view;
   PhotosBaseManager *item_mngr;
@@ -305,14 +307,20 @@ photos_preview_view_window_mode_changed (PhotosPreviewView *self, PhotosWindowMo
   switch (mode)
     {
     case PHOTOS_WINDOW_MODE_COLLECTIONS:
-    case PHOTOS_WINDOW_MODE_EDIT:
     case PHOTOS_WINDOW_MODE_FAVORITES:
     case PHOTOS_WINDOW_MODE_OVERVIEW:
     case PHOTOS_WINDOW_MODE_SEARCH:
+      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), FALSE);
+      photos_preview_nav_buttons_hide (priv->nav_buttons);
+      break;
+
+    case PHOTOS_WINDOW_MODE_EDIT:
+      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), TRUE);
       photos_preview_nav_buttons_hide (priv->nav_buttons);
       break;
 
     case PHOTOS_WINDOW_MODE_PREVIEW:
+      gtk_revealer_set_reveal_child (GTK_REVEALER (priv->revealer), FALSE);
       photos_preview_nav_buttons_show (priv->nav_buttons);
       break;
 
@@ -343,13 +351,25 @@ photos_preview_view_constructed (GObject *object)
 {
   PhotosPreviewView *self = PHOTOS_PREVIEW_VIEW (object);
   PhotosPreviewViewPrivate *priv = self->priv;
+  GtkWidget *grid;
+  GtkWidget *palette;
 
   G_OBJECT_CLASS (photos_preview_view_parent_class)->constructed (object);
 
+  grid = gtk_grid_new ();
+  gtk_container_add (GTK_CONTAINER (self), grid);
+
   /* Add the stack to the scrolled window after the default
    * adjustments have been created.
    */
-  gtk_container_add (GTK_CONTAINER (self), priv->stack);
+  gtk_container_add (GTK_CONTAINER (grid), priv->stack);
+
+  priv->revealer = gtk_revealer_new ();
+  gtk_revealer_set_transition_type (GTK_REVEALER (priv->revealer), GTK_REVEALER_TRANSITION_TYPE_SLIDE_LEFT);
+  gtk_container_add (GTK_CONTAINER (grid), priv->revealer);
+
+  palette = photos_edit_palette_new ();
+  gtk_container_add (GTK_CONTAINER (priv->revealer), palette);
 
   priv->nav_buttons = photos_preview_nav_buttons_new (self, GTK_OVERLAY (priv->overlay));
   g_signal_connect_swapped (priv->nav_buttons,
@@ -412,6 +432,8 @@ photos_preview_view_init (PhotosPreviewView *self)
   gtk_style_context_add_class (context, "documents-scrolledwin");
 
   priv->stack = gtk_stack_new ();
+  gtk_widget_set_hexpand (priv->stack, TRUE);
+  gtk_widget_set_vexpand (priv->stack, TRUE);
 
   view = photos_preview_view_create_view (self);
   gtk_container_add (GTK_CONTAINER (priv->stack), view);


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