[gnome-photos] pipeline: Refactor photos_pipeline_reset to be more extensible
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] pipeline: Refactor photos_pipeline_reset to be more extensible
- Date: Fri, 9 Sep 2016 12:22:18 +0000 (UTC)
commit 3dc0cf4d5634d185f638fa40e51be0c6f89610e6
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Apr 8 20:01:24 2016 +0200
pipeline: Refactor photos_pipeline_reset to be more extensible
This will make it easier to add more fixed position operations or
tweak their positions.
https://bugzilla.gnome.org/show_bug.cgi?id=764801
src/photos-pipeline.c | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
---
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index 2b16620..71f7e41 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -63,6 +63,12 @@ G_DEFINE_TYPE_EXTENDED (PhotosPipeline, photos_pipeline, G_TYPE_OBJECT, 0,
EGG_DEFINE_COUNTER (instances, "PhotosPipeline", "Instances", "Number of PhotosPipeline instances")
+static const gchar *OPERATIONS[] =
+{
+ "photos:insta-filter"
+};
+
+
static void
photos_pipeline_link_nodes (GeglNode *input, GeglNode *output, GSList *nodes)
{
@@ -93,20 +99,31 @@ photos_pipeline_link_nodes (GeglNode *input, GeglNode *output, GSList *nodes)
static void
photos_pipeline_reset (PhotosPipeline *self)
{
+ GSList *nodes = NULL;
GeglNode *input;
GeglNode *last;
- GeglNode *node;
GeglNode *output;
+ guint i;
input = gegl_node_get_input_proxy (self->graph, "input");
output = gegl_node_get_output_proxy (self->graph, "output");
last = gegl_node_get_producer (output, "input", NULL);
g_return_if_fail (last == input);
- node = gegl_node_new_child (self->graph, "operation", "photos:insta-filter", NULL);
- gegl_node_set_passthrough (node, TRUE);
- gegl_node_link_many (input, node, output, NULL);
- g_hash_table_insert (self->hash, g_strdup ("photos:insta-filter"), g_object_ref (node));
+ for (i = 0; i < G_N_ELEMENTS (OPERATIONS); i++)
+ {
+ GeglNode *node;
+
+ node = gegl_node_new_child (self->graph, "operation", OPERATIONS[i], NULL);
+ gegl_node_set_passthrough (node, TRUE);
+ g_hash_table_insert (self->hash, g_strdup (OPERATIONS[i]), g_object_ref (node));
+ nodes = g_slist_prepend (nodes, g_object_ref (node));
+ }
+
+ nodes = g_slist_reverse (nodes);
+ photos_pipeline_link_nodes (input, output, nodes);
+
+ g_slist_free_full (nodes, g_object_unref);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]