[gnome-photos] application, preview-view: Hook up blacks and exposure to a GAction
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] application, preview-view: Hook up blacks and exposure to a GAction
- Date: Thu, 9 Feb 2017 22:48:33 +0000 (UTC)
commit ce7038b72ec2a52d9d068020235544d91df48919
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Feb 3 00:42:04 2017 +0100
application, preview-view: Hook up blacks and exposure to a GAction
Bump minimum GEGL version to 0.3.11.
configure.ac | 2 +-
src/photos-application.c | 8 ++++++++
src/photos-preview-view.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4251de9..9e16915 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,7 +32,7 @@ GLIB_GSETTINGS
CAIRO_MIN_VERSION=1.14.0
GDATA_MIN_VERSION=0.15.2
-GEGL_MIN_VERSION=0.3.5
+GEGL_MIN_VERSION=0.3.11
GFBGRAPH_MIN_VERSION=0.2.1
GLIB_MIN_VERSION=2.44.0
GOA_MIN_VERSION=3.8.0
diff --git a/src/photos-application.c b/src/photos-application.c
index b52f72a..e089a46 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -74,6 +74,7 @@ struct _PhotosApplication
GResource *resource;
GSettings *bg_settings;
GSettings *ss_settings;
+ GSimpleAction *blacks_exposure_action;
GSimpleAction *brightness_contrast_action;
GSimpleAction *crop_action;
GSimpleAction *delete_action;
@@ -323,6 +324,7 @@ photos_application_actions_update (PhotosApplication *self)
selection_mode = photos_selection_controller_get_selection_mode (self->sel_cntrlr);
enable = (mode == PHOTOS_WINDOW_MODE_EDIT);
+ g_simple_action_set_enabled (self->blacks_exposure_action, enable);
g_simple_action_set_enabled (self->brightness_contrast_action, enable);
g_simple_action_set_enabled (self->crop_action, enable);
g_simple_action_set_enabled (self->denoise_action, enable);
@@ -1692,6 +1694,11 @@ photos_application_startup (GApplication *application)
g_object_unref (action);
parameter_type = g_variant_type_new ("a{sd}");
+ self->blacks_exposure_action = g_simple_action_new ("blacks-exposure-current", parameter_type);
+ g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->blacks_exposure_action));
+ g_variant_type_free (parameter_type);
+
+ parameter_type = g_variant_type_new ("a{sd}");
self->brightness_contrast_action = g_simple_action_new ("brightness-contrast-current", parameter_type);
g_action_map_add_action (G_ACTION_MAP (self), G_ACTION (self->brightness_contrast_action));
g_variant_type_free (parameter_type);
@@ -1885,6 +1892,7 @@ photos_application_dispose (GObject *object)
g_clear_object (&self->create_window_cancellable);
g_clear_object (&self->bg_settings);
g_clear_object (&self->ss_settings);
+ g_clear_object (&self->blacks_exposure_action);
g_clear_object (&self->brightness_contrast_action);
g_clear_object (&self->crop_action);
g_clear_object (&self->delete_action);
diff --git a/src/photos-preview-view.c b/src/photos-preview-view.c
index fe23cb9..9cc0eed 100644
--- a/src/photos-preview-view.c
+++ b/src/photos-preview-view.c
@@ -291,6 +291,43 @@ photos_preview_view_process (GObject *source_object, GAsyncResult *res, gpointer
static void
+photos_preview_view_blacks_exposure (PhotosPreviewView *self, GVariant *parameter)
+{
+ GVariantIter iter;
+ PhotosBaseItem *item;
+ const gchar *key;
+ gdouble blacks = -G_MAXDOUBLE;
+ gdouble exposure = -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, "blacks") == 0)
+ blacks = value;
+ else if (g_strcmp0 (key, "exposure") == 0)
+ exposure = value;
+ }
+
+ g_return_if_fail (blacks > -G_MAXDOUBLE);
+ g_return_if_fail (exposure > -G_MAXDOUBLE);
+
+ photos_base_item_operation_add_async (item,
+ self->cancellable,
+ photos_preview_view_process,
+ self,
+ "gegl:exposure",
+ "black", blacks,
+ "exposure", exposure,
+ NULL);
+}
+
+
+static void
photos_preview_view_brightness_contrast (PhotosPreviewView *self, GVariant *parameter)
{
GVariantIter iter;
@@ -715,6 +752,13 @@ photos_preview_view_init (PhotosPreviewView *self)
gtk_container_add (GTK_CONTAINER (sw), self->palette);
g_signal_connect_swapped (self->palette, "tool-changed", G_CALLBACK (photos_preview_view_tool_changed),
self);
+ action = g_action_map_lookup_action (G_ACTION_MAP (app), "blacks-exposure-current");
+ g_signal_connect_object (action,
+ "activate",
+ G_CALLBACK (photos_preview_view_blacks_exposure),
+ self,
+ G_CONNECT_SWAPPED);
+
action = g_action_map_lookup_action (G_ACTION_MAP (app), "brightness-contrast-current");
g_signal_connect_object (action,
"activate",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]