[gnome-photos/wip/rishi/double-buffering: 6/7] pipeline: Add photos_pipeline_addl



commit 93934cd432bfbed8789bc77e07365570180b11eb
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 20 19:34:20 2017 +0100

    pipeline: Add photos_pipeline_addl
    
    This photos_pipeline_add variant will add a new operation from a GList
    of GParameters containing the properties and their values. This will be
    useful in a subsequent commit.
    
    Rewrite photos_pipeline_add_valist in terms of this new method to avoid
    duplicating code.

 src/photos-pipeline.c |   24 +++++++++++++++++++++++-
 src/photos-pipeline.h |    4 ++++
 2 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index 9e24ec8..8702d01 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -455,6 +455,19 @@ photos_pipeline_add_valist (PhotosPipeline *self,
                             const gchar *first_property_name,
                             va_list ap)
 {
+  GList *parameters = NULL;
+
+  parameters = photos_utils_create_operation_parameters_from_valist (operation, first_property_name, ap);
+  photos_pipeline_addl (self, operation, parameters);
+  g_list_free_full (parameters, (GDestroyNotify) photos_utils_parameter_free);
+}
+
+
+void
+photos_pipeline_addl (PhotosPipeline *self, const gchar *operation, GList *parameters)
+{
+  GList *l;
+  GeglOperation *op;
   GeglNode *input;
   GeglNode *last;
   GeglNode *node;
@@ -481,7 +494,16 @@ photos_pipeline_add_valist (PhotosPipeline *self,
       gegl_node_set_passthrough (node, FALSE);
     }
 
-  gegl_node_set_valist (node, first_property_name, ap);
+  op = gegl_node_get_gegl_operation (node);
+  g_object_freeze_notify (G_OBJECT (op));
+
+  for (l = parameters; l != NULL; l = l->next)
+    {
+      GParameter *parameter = (GParameter *) l->data;
+      gegl_node_set_property (node, parameter->name, &parameter->value);
+    }
+
+  g_object_thaw_notify (G_OBJECT (op));
 
   xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
   photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
diff --git a/src/photos-pipeline.h b/src/photos-pipeline.h
index 88ff6c2..96c8ead 100644
--- a/src/photos-pipeline.h
+++ b/src/photos-pipeline.h
@@ -57,6 +57,10 @@ void                   photos_pipeline_add_valist        (PhotosPipeline *self,
                                                           const gchar *first_property_name,
                                                           va_list ap);
 
+void                   photos_pipeline_addl              (PhotosPipeline *self,
+                                                          const gchar *operation,
+                                                          GList *parameters);
+
 gboolean               photos_pipeline_get_valist        (PhotosPipeline *self,
                                                           const gchar *operation,
                                                           const gchar *first_property_name,


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