[gnome-photos] pipeline: Refactor connecting a list of nodes into a separate function
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos] pipeline: Refactor connecting a list of nodes into a separate function
- Date: Fri, 9 Sep 2016 12:22:13 +0000 (UTC)
commit 05ab6526c626f6d73c3357e2d00a54f68193d882
Author: Debarshi Ray <debarshir gnome org>
Date: Fri Apr 8 19:56:31 2016 +0200
pipeline: Refactor connecting a list of nodes into a separate function
We are going to use this when initializing the pipeline with nodes in
pre-determined positions.
https://bugzilla.gnome.org/show_bug.cgi?id=764801
src/photos-pipeline.c | 51 +++++++++++++++++++++++++++---------------------
1 files changed, 29 insertions(+), 22 deletions(-)
---
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index d5558ff..2b16620 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -64,6 +64,33 @@ EGG_DEFINE_COUNTER (instances, "PhotosPipeline", "Instances", "Number of PhotosP
static void
+photos_pipeline_link_nodes (GeglNode *input, GeglNode *output, GSList *nodes)
+{
+ GSList *l;
+ GeglNode *node;
+
+ if (nodes == NULL)
+ {
+ gegl_node_link (input, output);
+ return;
+ }
+
+ node = GEGL_NODE (nodes->data);
+ gegl_node_link (input, node);
+
+ for (l = nodes; l != NULL && l->next != NULL; l = l->next)
+ {
+ GeglNode *sink = GEGL_NODE (l->next->data);
+ GeglNode *source = GEGL_NODE (l->data);
+ gegl_node_link (source, sink);
+ }
+
+ node = GEGL_NODE (l->data);
+ gegl_node_link (node, output);
+}
+
+
+static void
photos_pipeline_reset (PhotosPipeline *self)
{
GeglNode *input;
@@ -88,7 +115,6 @@ photos_pipeline_create_graph_from_xml (PhotosPipeline *self, const gchar *conten
{
GeglNode *graph = NULL;
GeglNode *input;
- GeglNode *node;
GeglNode *output;
GSList *children = NULL;
GSList *l;
@@ -112,19 +138,12 @@ photos_pipeline_create_graph_from_xml (PhotosPipeline *self, const gchar *conten
output = gegl_node_get_output_proxy (self->graph, "output");
children = gegl_node_get_children (graph);
- if (children == NULL)
- {
- gegl_node_link (input, output);
- goto carry_on;
- }
-
for (l = children; l != NULL; l = l->next)
{
+ GeglNode *node = GEGL_NODE (l->data);
const gchar *operation;
const gchar *operation_compat;
- node = GEGL_NODE (l->data);
-
g_object_ref (node);
gegl_node_remove_child (graph, node);
gegl_node_add_child (self->graph, node);
@@ -138,20 +157,8 @@ photos_pipeline_create_graph_from_xml (PhotosPipeline *self, const gchar *conten
g_hash_table_insert (self->hash, g_strdup (operation_compat), g_object_ref (node));
}
- node = GEGL_NODE (children->data);
- gegl_node_link (input, node);
-
- for (l = children; l != NULL && l->next != NULL; l = l->next)
- {
- GeglNode *sink = GEGL_NODE (l->next->data);
- GeglNode *source = GEGL_NODE (l->data);
- gegl_node_link (source, sink);
- }
-
- node = GEGL_NODE (l->data);
- gegl_node_link (node, output);
+ photos_pipeline_link_nodes (input, output, children);
- carry_on:
ret_val = TRUE;
out:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]