[gnome-photos/wip/rishi/edit-mode: 19/26] application, preview-view: Hook up photos:insta-filter to a GAction



commit 84532a1765c3b427ba9a05a3f91eddb702246cfa
Author: Debarshi Ray <debarshir gnome org>
Date:   Thu May 28 09:46:58 2015 +0200

    application, preview-view: Hook up photos:insta-filter to a GAction

 src/photos-application.c  |    6 ++++++
 src/photos-preview-view.c |   20 ++++++++++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index b501fc7..7d30ce2 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -69,6 +69,7 @@ struct _PhotosApplicationPrivate
   GSimpleAction *fs_action;
   GSimpleAction *gear_action;
   GSimpleAction *gray_action;
+  GSimpleAction *insta_action;
   GSimpleAction *open_action;
   GSimpleAction *print_action;
   GSimpleAction *properties_action;
@@ -695,6 +696,7 @@ photos_application_window_mode_changed (PhotosApplication *self, PhotosWindowMod
 
   enable = (mode == PHOTOS_WINDOW_MODE_EDIT);
   g_simple_action_set_enabled (priv->gray_action, enable);
+  g_simple_action_set_enabled (priv->insta_action, enable);
   g_simple_action_set_enabled (priv->undo_action, enable);
 
   enable = (mode == PHOTOS_WINDOW_MODE_COLLECTIONS
@@ -923,6 +925,9 @@ photos_application_startup (GApplication *application)
   priv->gray_action = g_simple_action_new ("gray-current", NULL);
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->gray_action));
 
+  priv->insta_action = g_simple_action_new ("insta-current", G_VARIANT_TYPE_INT16);
+  g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->insta_action));
+
   priv->open_action = g_simple_action_new ("open-current", NULL);
   g_signal_connect_swapped (priv->open_action, "activate", G_CALLBACK (photos_application_open_current), 
self);
   g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->open_action));
@@ -1062,6 +1067,7 @@ photos_application_dispose (GObject *object)
   g_clear_object (&priv->fs_action);
   g_clear_object (&priv->gear_action);
   g_clear_object (&priv->gray_action);
+  g_clear_object (&priv->insta_action);
   g_clear_object (&priv->open_action);
   g_clear_object (&priv->print_action);
   g_clear_object (&priv->properties_action);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 7f63ec0..abb3027 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -33,6 +33,7 @@
 #include "photos-base-item.h"
 #include "photos-base-manager.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"
@@ -265,6 +266,22 @@ photos_preview_view_gray (PhotosPreviewView *self)
 
 
 static void
+photos_preview_view_insta (PhotosPreviewView *self, GVariant *parameter)
+{
+  PhotosBaseItem *item;
+  PhotosOperationInstaPreset preset;
+
+  item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
+  if (item == NULL)
+    return;
+
+  preset = (PhotosOperationInstaPreset) g_variant_get_int16 (parameter);
+  photos_base_item_operation_add (item, "photos:insta-filter", "preset", preset, NULL);
+  photos_base_item_process_async (item, NULL, photos_preview_view_process, self);
+}
+
+
+static void
 photos_preview_view_undo (PhotosPreviewView *self)
 {
   PhotosBaseItem *item;
@@ -404,6 +421,9 @@ photos_preview_view_init (PhotosPreviewView *self)
   action = g_action_map_lookup_action (G_ACTION_MAP (app), "gray-current");
   g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_gray), 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);
+
   action = g_action_map_lookup_action (G_ACTION_MAP (app), "undo-current");
   g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_undo), self, 
G_CONNECT_SWAPPED);
 }


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