[gnome-photos/wip/rishi/edit-mode: 30/31] preview-view: crop
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/edit-mode: 30/31] preview-view: crop
- Date: Fri, 6 Nov 2015 18:29:50 +0000 (UTC)
commit 1c113860f56e6c6d0fbc141918aa42eee8fb2a5d
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Nov 6 19:26:17 2015 +0100
preview-view: crop
src/photos-preview-view.c | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 852830f..d3a9ac9 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -273,6 +273,40 @@ photos_preview_view_process (GObject *source_object, GAsyncResult *res, gpointer
static void
+photos_preview_view_crop (PhotosPreviewView *self, GVariant *parameter)
+{
+ GVariantIter iter;
+ PhotosBaseItem *item;
+ const gchar *key;
+ gdouble height;
+ gdouble width;
+ gdouble value;
+ gdouble x;
+ gdouble y;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
+ if (item == NULL)
+ return;
+
+ g_variant_iter_init (&iter, parameter);
+ while (g_variant_iter_next (&iter, "{&sd}", &key, &value))
+ {
+ if (g_strcmp0 (key, "height") == 0)
+ height = value;
+ else if (g_strcmp0 (key, "width") == 0)
+ width = value;
+ else if (g_strcmp0 (key, "x") == 0)
+ x = value;
+ else if (g_strcmp0 (key, "y") == 0)
+ y = value;
+ }
+
+ photos_base_item_operation_add (item, "gegl:crop", "height", height, "width", width, "x", x, "y", y, NULL);
+ photos_base_item_process_async (item, NULL, photos_preview_view_process, self);
+}
+
+
+static void
photos_preview_view_insta (PhotosPreviewView *self, GVariant *parameter)
{
PhotosBaseItem *item;
@@ -313,9 +347,12 @@ photos_preview_view_tool_changed (PhotosPreviewView *self, PhotosTool *tool)
if (priv->current_tool == tool)
return;
- view = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
+ if (priv->current_tool != NULL)
+ photos_tool_deactivate (priv->current_tool);
g_clear_object (&priv->current_tool);
+ view = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
+
if (tool != NULL)
{
PhotosBaseItem *item;
@@ -484,6 +521,9 @@ photos_preview_view_init (PhotosPreviewView *self)
view = photos_preview_view_create_view (self);
gtk_container_add (GTK_CONTAINER (priv->stack), view);
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), "crop-current");
+ g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_crop), self,
G_CONNECT_SWAPPED);
+
action = g_action_map_lookup_action (G_ACTION_MAP (app), "insta-current");
g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_insta), self,
G_CONNECT_SWAPPED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]