[gnome-photos/wip/rishi/edit-mode: 24/30] preview-view: Use EditPalette for showing the editing controls
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 24/30] preview-view: Use EditPalette for showing the editing controls
- Date: Sun, 14 Jun 2015 18:14:42 +0000 (UTC)
commit 37dafb300880ca5696eb7e8f6516aa9a01c4fac9
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 | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 914d2de..8322e5a 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -32,22 +32,26 @@
#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"
#include "photos-preview-view.h"
#include "photos-search-context.h"
+#include "photos-tool.h"
struct _PhotosPreviewViewPrivate
{
GeglNode *node;
GtkWidget *overlay;
+ GtkWidget *revealer;
GtkWidget *stack;
GtkWidget *view;
PhotosBaseManager *item_mngr;
PhotosModeController *mode_cntrlr;
PhotosPreviewNavButtons *nav_buttons;
+ PhotosTool *active_tool;
};
enum
@@ -284,6 +288,17 @@ photos_preview_view_sharpen (PhotosPreviewView *self, GVariant *parameter)
static void
+photos_preview_view_tool_changed (PhotosPreviewView *self, PhotosTool *tool)
+{
+ PhotosPreviewViewPrivate *priv = self->priv;
+
+ g_clear_object (&priv->active_tool);
+ if (tool != NULL)
+ priv->active_tool = g_object_ref (tool);
+}
+
+
+static void
photos_preview_view_undo (PhotosPreviewView *self)
{
PhotosBaseItem *item;
@@ -305,14 +320,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;
@@ -333,6 +354,7 @@ photos_preview_view_dispose (GObject *object)
g_clear_object (&priv->node);
g_clear_object (&priv->item_mngr);
g_clear_object (&priv->mode_cntrlr);
+ g_clear_object (&priv->active_tool);
G_OBJECT_CLASS (photos_preview_view_parent_class)->dispose (object);
}
@@ -343,13 +365,26 @@ 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);
+ g_signal_connect_swapped (palette, "tool-changed", G_CALLBACK (photos_preview_view_tool_changed), self);
priv->nav_buttons = photos_preview_nav_buttons_new (self, GTK_OVERLAY (priv->overlay));
g_signal_connect_swapped (priv->nav_buttons,
@@ -412,6 +447,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]