[gnome-photos] pipeline: Serialize the graph without invalidating the nodes



commit 9821127eff65ac348b5d83d7cec1cd2d9b2a1134
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Jan 20 13:06:51 2016 +0100

    pipeline: Serialize the graph without invalidating the nodes
    
    One nice side-effect of this is that trying to export an image after
    editing doesn't lead to a CRITICAL. Earlier, one would have to restart
    the application after editing to avoid it.
    
    Bump minimum GEGL version to 0.3.5.

 configure.ac          |    2 +-
 src/photos-pipeline.c |   37 ++++---------------------------------
 2 files changed, 5 insertions(+), 34 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9829a66..a1a4a9f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,7 +31,7 @@ GLIB_GSETTINGS
 
 CAIRO_MIN_VERSION=1.14.0
 GDATA_MIN_VERSION=0.15.2
-GEGL_MIN_VERSION=0.3.2
+GEGL_MIN_VERSION=0.3.5
 GFBGRAPH_MIN_VERSION=0.2.1
 GLIB_MIN_VERSION=2.39.3
 GOA_MIN_VERSION=3.8.0
diff --git a/src/photos-pipeline.c b/src/photos-pipeline.c
index b1f9688..819c33d 100644
--- a/src/photos-pipeline.c
+++ b/src/photos-pipeline.c
@@ -1,6 +1,6 @@
 /*
  * Photos - access, organize and share your photos on GNOME
- * Copyright © 2015 Red Hat, Inc.
+ * Copyright © 2015, 2016 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -60,35 +60,6 @@ G_DEFINE_TYPE_EXTENDED (PhotosPipeline, photos_pipeline, G_TYPE_OBJECT, 0,
                         G_IMPLEMENT_INTERFACE (G_TYPE_ASYNC_INITABLE, 
photos_pipeline_async_initable_iface_init));
 
 
-static gchar *
-photos_pipeline_to_xml (PhotosPipeline *self)
-{
-  GeglNode *input;
-  GeglNode *last;
-  GeglNode *output;
-  gchar *ret_val;
-
-  /* PhotosPipeline can be connected to a gegl:buffer-source, in which
-   * case we will get a WARNING about trying to serialize the
-   * GeglBuffer. We work around that.
-   */
-
-  input = gegl_node_get_input_proxy (self->graph, "input");
-  output = gegl_node_get_output_proxy (self->graph, "output");
-
-  last = gegl_node_get_producer (input, "input", NULL);
-  if (last != NULL)
-    gegl_node_disconnect (input, "input");
-
-  ret_val = gegl_node_to_xml (output, "/");
-
-  if (last != NULL)
-    gegl_node_link (last, input);
-
-  return ret_val;
-}
-
-
 static void
 photos_pipeline_save_replace_contents (GObject *source_object, GAsyncResult *res, gpointer user_data)
 {
@@ -439,7 +410,7 @@ photos_pipeline_add (PhotosPipeline *self, const gchar *operation, const gchar *
 
   gegl_node_set_valist (node, first_property_name, ap);
 
-  xml = photos_pipeline_to_xml (self);
+  xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
   photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
 
   /* We want to remove the nodes from the graph too. */
@@ -529,7 +500,7 @@ photos_pipeline_save_async (PhotosPipeline *self,
   gchar *xml = NULL;
   gsize len;
 
-  xml = photos_pipeline_to_xml (self);
+  xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
   g_return_if_fail (xml != NULL);
 
   task = g_task_new (self, cancellable, callback, user_data);
@@ -596,7 +567,7 @@ photos_pipeline_undo (PhotosPipeline *self)
   gegl_node_disconnect (last, "input");
   gegl_node_link (last2, output);
 
-  xml = photos_pipeline_to_xml (self);
+  xml = gegl_node_to_xml_full (self->graph, self->graph, "/");
   photos_debug (PHOTOS_DEBUG_GEGL, "Pipeline: %s", xml);
 
   ret_val = TRUE;


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