[gnome-photos] application, preview-view: Hook up saturation to a GAction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] application, preview-view: Hook up saturation to a GAction
- Date: Thu, 7 Jan 2016 16:55:52 +0000 (UTC)
commit 2a6d97addc609dc5b237be3885ecdbdbcb309616
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Jan 7 16:45:26 2016 +0100
application, preview-view: Hook up saturation to a GAction
src/photos-application.c | 6 ++++++
src/photos-preview-view.c | 25 ++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 3a1e99b..a1f5175 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -81,6 +81,7 @@ struct _PhotosApplicationPrivate
GSimpleAction *open_action;
GSimpleAction *print_action;
GSimpleAction *properties_action;
+ GSimpleAction *saturation_action;
GSimpleAction *save_action;
GSimpleAction *search_action;
GSimpleAction *search_match_action;
@@ -277,6 +278,7 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (priv->edit_cancel_action, enable);
g_simple_action_set_enabled (priv->edit_done_action, enable);
g_simple_action_set_enabled (priv->insta_action, enable);
+ g_simple_action_set_enabled (priv->saturation_action, enable);
g_simple_action_set_enabled (priv->sharpen_action, enable);
g_simple_action_set_enabled (priv->undo_action, enable);
@@ -1417,6 +1419,9 @@ photos_application_startup (GApplication *application)
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (action));
g_object_unref (action);
+ priv->saturation_action = g_simple_action_new ("saturation-current", G_VARIANT_TYPE_DOUBLE);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->saturation_action));
+
priv->save_action = g_simple_action_new ("save-current", NULL);
g_signal_connect_swapped (priv->save_action, "activate", G_CALLBACK (photos_application_save), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (priv->save_action));
@@ -1560,6 +1565,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&priv->open_action);
g_clear_object (&priv->print_action);
g_clear_object (&priv->properties_action);
+ g_clear_object (&priv->saturation_action);
g_clear_object (&priv->save_action);
g_clear_object (&priv->search_action);
g_clear_object (&priv->search_match_action);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 9e81c4d..1acf8ae 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -1,6 +1,6 @@
/*
* Photos - access, organize and share your photos on GNOME
- * Copyright © 2013, 2014, 2015 Red Hat, Inc.
+ * Copyright © 2013, 2014, 2015, 2016 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
@@ -401,6 +401,22 @@ photos_preview_view_insta (PhotosPreviewView *self, GVariant *parameter)
static void
+photos_preview_view_saturation (PhotosPreviewView *self, GVariant *parameter)
+{
+ PhotosBaseItem *item;
+ gfloat scale;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->priv->item_mngr));
+ if (item == NULL)
+ return;
+
+ scale = (gfloat) g_variant_get_double (parameter);
+ photos_base_item_operation_add (item, "photos:saturation", "scale", scale, NULL);
+ photos_base_item_process_async (item, NULL, photos_preview_view_process, self);
+}
+
+
+static void
photos_preview_view_sharpen (PhotosPreviewView *self, GVariant *parameter)
{
PhotosBaseItem *item;
@@ -641,6 +657,13 @@ photos_preview_view_init (PhotosPreviewView *self)
action = g_action_map_lookup_action (G_ACTION_MAP (app), "load-previous");
g_signal_connect_swapped (action, "activate", G_CALLBACK (photos_preview_view_navigate_previous), self);
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), "saturation-current");
+ g_signal_connect_object (action,
+ "activate",
+ G_CALLBACK (photos_preview_view_saturation),
+ self,
+ G_CONNECT_SWAPPED);
+
action = g_action_map_lookup_action (G_ACTION_MAP (app), "sharpen-current");
g_signal_connect_object (action, "activate", G_CALLBACK (photos_preview_view_sharpen), self,
G_CONNECT_SWAPPED);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]