[gnome-photos/wip/uajain/shadows_highlights: 1/2] Add shadows-highlights action
- From: Umang Jain <uajain src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/uajain/shadows_highlights: 1/2] Add shadows-highlights action
- Date: Fri, 27 Oct 2017 06:25:46 +0000 (UTC)
commit ae2006d2406a5e8b6f671dc9183082d4a37f939d
Author: Umang Jain <mailumangjain gmail com>
Date: Wed Oct 25 18:20:26 2017 +0530
Add shadows-highlights action
https://bugzilla.gnome.org/show_bug.cgi?id=788201
src/photos-application.c | 6 ++++++
src/photos-preview-view.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index 3a4b02c..25d58d5 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -109,6 +109,7 @@ struct _PhotosApplication
GSimpleAction *selection_mode_action;
GSimpleAction *set_bg_action;
GSimpleAction *set_ss_action;
+ GSimpleAction *shadows_highlights_action;
GSimpleAction *share_action;
GSimpleAction *sharpen_action;
GSimpleAction *zoom_best_fit_action;
@@ -386,6 +387,7 @@ photos_application_actions_update (PhotosApplication *self)
g_simple_action_set_enabled (self->edit_done_action, enable);
g_simple_action_set_enabled (self->insta_action, enable);
g_simple_action_set_enabled (self->saturation_action, enable);
+ g_simple_action_set_enabled (self->shadows_highlights_action, enable);
g_simple_action_set_enabled (self->sharpen_action, enable);
enable = FALSE;
@@ -2052,6 +2054,9 @@ photos_application_startup (GApplication *application)
g_signal_connect_swapped (self->set_ss_action, "activate", G_CALLBACK
(photos_application_set_screensaver), self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->set_ss_action));
+ self->shadows_highlights_action = g_simple_action_new ("shadows-highlights-current", G_VARIANT_TYPE
("a{sd}"));
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->shadows_highlights_action));
+
self->share_action = g_simple_action_new ("share-current", NULL);
g_signal_connect_swapped (self->share_action, "activate", G_CALLBACK (photos_application_share_current),
self);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->share_action));
@@ -2169,6 +2174,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&self->selection_mode_action);
g_clear_object (&self->set_bg_action);
g_clear_object (&self->set_ss_action);
+ g_clear_object (&self->shadows_highlights_action);
g_clear_object (&self->share_action);
g_clear_object (&self->sharpen_action);
g_clear_object (&self->zoom_best_fit_action);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index 15bc98a..4b49125 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -564,6 +564,43 @@ photos_preview_view_brightness_contrast (PhotosPreviewView *self, GVariant *para
static void
+photos_preview_view_shadows_highlights (PhotosPreviewView *self, GVariant *parameter)
+{
+ GVariantIter iter;
+ PhotosBaseItem *item;
+ const gchar *key;
+ gdouble shadows = -G_MAXDOUBLE;
+ gdouble highlights = -G_MAXDOUBLE;
+ gdouble value;
+
+ item = PHOTOS_BASE_ITEM (photos_base_manager_get_active_object (self->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, "shadows") == 0)
+ shadows = value;
+ else if (g_strcmp0 (key, "highlights") == 0)
+ highlights = value;
+ }
+
+ g_return_if_fail (shadows > -G_MAXDOUBLE);
+ g_return_if_fail (highlights > -G_MAXDOUBLE);
+
+ photos_base_item_operation_add_async (item,
+ self->cancellable,
+ photos_preview_view_process,
+ self,
+ "gegl:shadows-highlights",
+ "shadows", shadows,
+ "highlights", highlights,
+ NULL);
+}
+
+
+static void
photos_preview_view_crop (PhotosPreviewView *self, GVariant *parameter)
{
GVariantIter iter;
@@ -1092,6 +1129,13 @@ photos_preview_view_init (PhotosPreviewView *self)
self,
G_CONNECT_SWAPPED);
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), "shadows-highlights-current");
+ g_signal_connect_object (action,
+ "activate",
+ G_CALLBACK (photos_preview_view_shadows_highlights),
+ 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]