Commit 2a6d97ad authored by Debarshi Ray's avatar Debarshi Ray

application, preview-view: Hook up saturation to a GAction

parent 37020eef
......@@ -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);
......
/*
* 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
......@@ -400,6 +400,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)
{
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment