[gnome-photos/wip/edit: 4/4] experiments
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/edit: 4/4] experiments
- Date: Tue, 4 Feb 2014 10:47:13 +0000 (UTC)
commit 56173f7164471d9250e0383af35c432f16a35e8a
Author: Debarshi Ray <debarshir gnome org>
Date: Mon Feb 3 10:35:09 2014 +0100
experiments
src/photos-base-item.c | 31 ++++++++++++++++++++++++++-----
src/photos-base-item.h | 6 +++++-
src/photos-icons.h | 3 +++
src/photos-preview-nav-buttons.c | 32 ++++++++++++++++++++++++++++++++
src/photos-preview-view.c | 6 ++++++
5 files changed, 72 insertions(+), 6 deletions(-)
---
diff --git a/src/photos-base-item.c b/src/photos-base-item.c
index 81d598d..df0858a 100644
--- a/src/photos-base-item.c
+++ b/src/photos-base-item.c
@@ -36,6 +36,7 @@
#include "photos-collection-icon-watcher.h"
#include "photos-delete-item-job.h"
#include "photos-icons.h"
+#include "photos-pipeline.h"
#include "photos-print-operation.h"
#include "photos-query.h"
#include "photos-selection-controller.h"
@@ -48,13 +49,14 @@ struct _PhotosBaseItemPrivate
GdkPixbuf *icon;
GdkPixbuf *pristine_icon;
GeglNode *graph;
- GeglNode *node;
+ GeglNode *load;
GeglRectangle bbox;
GMutex mutex_download;
GMutex mutex;
GQuark equipment;
GQuark flash;
PhotosCollectionIconWatcher *watcher;
+ PhotosPipeline *pipeline;
PhotosSelectionController *sel_cntrlr;
TrackerSparqlCursor *cursor;
gboolean collection;
@@ -554,9 +556,14 @@ static GeglNode *
photos_base_item_load (PhotosBaseItem *self, GCancellable *cancellable, GError **error)
{
PhotosBaseItemPrivate *priv = self->priv;
+ GeglNode *edit;
+ GeglNode *input;
+ GeglNode *output = NULL;
GeglNode *ret_val = NULL;
gchar *path = NULL;
+ edit = photos_pipeline_get_graph (priv->pipeline);
+
if (priv->graph == NULL)
{
path = photos_base_item_download (self, cancellable, error);
@@ -564,15 +571,20 @@ photos_base_item_load (PhotosBaseItem *self, GCancellable *cancellable, GError *
goto out;
priv->graph = gegl_node_new ();
- priv->node = gegl_node_new_child (priv->graph,
+ priv->load = gegl_node_new_child (priv->graph,
"operation", "gegl:load",
"path", path,
NULL);
+ priv->bbox = gegl_node_get_bounding_box (priv->load);
+
+ gegl_node_add_child (priv->graph, edit);
+ input = gegl_node_get_input_proxy (edit, "input");
+ gegl_node_link (priv->load, input);
}
- gegl_node_process (priv->node);
- priv->bbox = gegl_node_get_bounding_box (priv->node);
- ret_val = g_object_ref (priv->node);
+ output = gegl_node_get_output_proxy (edit, "output");
+ gegl_node_process (output);
+ ret_val = g_object_ref (output);
out:
g_free (path);
@@ -812,6 +824,7 @@ photos_base_item_dispose (GObject *object)
g_clear_object (&priv->icon);
g_clear_object (&priv->pristine_icon);
g_clear_object (&priv->watcher);
+ g_clear_object (&priv->pipeline);
g_clear_object (&priv->sel_cntrlr);
g_clear_object (&priv->cursor);
@@ -895,6 +908,7 @@ photos_base_item_init (PhotosBaseItem *self)
g_mutex_init (&priv->mutex_download);
g_mutex_init (&priv->mutex);
+ priv->pipeline = photos_pipeline_new (self);
priv->sel_cntrlr = photos_selection_controller_dup_singleton ();
}
@@ -957,6 +971,13 @@ photos_base_item_class_init (PhotosBaseItemClass *class)
}
+void
+photos_base_item_add_operation (PhotosBaseItem *self, PhotosOperation *operation)
+{
+ photos_pipeline_add_operation (self->priv->pipeline, operation);
+}
+
+
gboolean
photos_base_item_can_trash (PhotosBaseItem *self)
{
diff --git a/src/photos-base-item.h b/src/photos-base-item.h
index f9325a2..e0e7bea 100644
--- a/src/photos-base-item.h
+++ b/src/photos-base-item.h
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2012, 2013 Red Hat, Inc.
+ * Copyright © 2012, 2013, 2014 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
@@ -30,6 +30,8 @@
#include <glib-object.h>
#include <gtk/gtk.h>
+#include "photos-operation.h"
+
G_BEGIN_DECLS
#define PHOTOS_TYPE_BASE_ITEM (photos_base_item_get_type ())
@@ -82,6 +84,8 @@ struct _PhotosBaseItemClass
GType photos_base_item_get_type (void) G_GNUC_CONST;
+void photos_base_item_add_operation (PhotosBaseItem *self, PhotosOperation *operation);
+
gboolean photos_base_item_can_trash (PhotosBaseItem *self);
void photos_base_item_destroy (PhotosBaseItem *self);
diff --git a/src/photos-icons.h b/src/photos-icons.h
index 7fd01f0..6874db7 100644
--- a/src/photos-icons.h
+++ b/src/photos-icons.h
@@ -33,6 +33,9 @@ G_BEGIN_DECLS
#define PHOTOS_ICON_GO_NEXT_SYMBOLIC "go-next-symbolic"
#define PHOTOS_ICON_GO_PREVIOUS_SYMBOLIC "go-previous-symbolic"
+#define PHOTOS_ICON_OBJECT_ROTATE_LEFT_SYMBOLIC "object-rotate-left-symbolic"
+#define PHOTOS_ICON_OBJECT_ROTATE_RIGHT_SYMBOLIC "object-rotate-right-symbolic"
+
#define PHOTOS_ICON_OBJECT_SELECT_SYMBOLIC "object-select-symbolic"
#define PHOTOS_ICON_PHOTOS_SYMBOLIC "emblem-photos-symbolic"
diff --git a/src/photos-preview-nav-buttons.c b/src/photos-preview-nav-buttons.c
index f0c4e8c..d689c76 100644
--- a/src/photos-preview-nav-buttons.c
+++ b/src/photos-preview-nav-buttons.c
@@ -33,6 +33,7 @@
#include "photos-item-manager.h"
#include "photos-preview-model.h"
#include "photos-preview-nav-buttons.h"
+#include "photos-rotate-left.h"
#include "photos-view-model.h"
@@ -45,6 +46,8 @@ struct _PhotosPreviewNavButtonsPrivate
GtkWidget *overlay;
GtkWidget *prev_widget;
GtkWidget *preview_view;
+ GtkWidget *rotate_left_button;
+ GtkWidget *rotate_right_button;
GtkWidget *toolbar_widget;
PhotosBaseManager *item_mngr;
gboolean hover;
@@ -322,6 +325,19 @@ photos_preview_nav_buttons_prev_clicked (PhotosPreviewNavButtons *self)
static void
+photos_preview_nav_buttons_rotate_left_clicked (PhotosPreviewNavButtons *self)
+{
+ PhotosBaseItem *item;
+ PhotosOperation *operation;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
+ operation = photos_rotate_left_new ();
+ photos_base_item_add_operation (item, operation);
+ g_object_unref (operation);
+}
+
+
+static void
photos_preview_nav_buttons_dispose (GObject *object)
{
PhotosPreviewNavButtons *self = PHOTOS_PREVIEW_NAV_BUTTONS (object);
@@ -444,6 +460,22 @@ photos_preview_nav_buttons_constructed (GObject *object)
G_CALLBACK (photos_preview_nav_buttons_leave_notify),
self);
+ priv->rotate_left_button = gd_header_simple_button_new ();
+ gd_header_button_set_label (GD_HEADER_BUTTON (priv->rotate_left_button), _("Rotate 90 degrees to the
left"));
+ gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->rotate_left_button),
+ PHOTOS_ICON_OBJECT_ROTATE_LEFT_SYMBOLIC);
+ gtk_action_bar_pack_start (GTK_ACTION_BAR (toolbar), priv->rotate_left_button);
+ g_signal_connect_swapped (priv->rotate_left_button,
+ "clicked",
+ G_CALLBACK (photos_preview_nav_buttons_rotate_left_clicked),
+ self);
+
+ priv->rotate_right_button = gd_header_simple_button_new ();
+ gd_header_button_set_label (GD_HEADER_BUTTON (priv->rotate_right_button), _("Rotate 90 degrees to the
right"));
+ gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->rotate_right_button),
+ PHOTOS_ICON_OBJECT_ROTATE_RIGHT_SYMBOLIC);
+ gtk_action_bar_pack_start (GTK_ACTION_BAR (toolbar), priv->rotate_right_button);
+
priv->favorite_button = gd_header_toggle_button_new ();
gd_header_button_set_symbolic_icon_name (GD_HEADER_BUTTON (priv->favorite_button),
PHOTOS_ICON_FAVORITE_SYMBOLIC);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 00e629b..79cd53d 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -268,6 +268,12 @@ photos_preview_view_set_node (PhotosPreviewView *self, GeglNode *node)
gegl_gtk_view_set_node (GEGL_GTK_VIEW (priv->view), g_object_ref (priv->node));
gtk_widget_queue_draw (priv->view);
+ g_signal_connect_swapped (priv->node, "computed", G_CALLBACK (gtk_widget_queue_draw), priv->view);
+ g_signal_connect_swapped (priv->node,
+ "invalidated",
+ G_CALLBACK (photos_preview_view_scale_and_align_image),
+ self);
+
out:
photos_preview_nav_buttons_show (priv->nav_buttons);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]