[gimp/gimp-2-10] libgimpbase, libgimp, app: inherit swap-compression in plug-ins



commit 4e71435112444be7b8da515a477781e5950d4bff
Author: Ell <ell_se yahoo com>
Date:   Sun Sep 22 17:48:16 2019 +0300

    libgimpbase, libgimp, app: inherit swap-compression in plug-ins
    
    Pass the swap-compression option set in the preferences down to
    plug-ins, so that they use the same swap-compression algorithm as
    the main app.
    
    (cherry picked from commit 5cc289b6429d86e179a26b6b6d2b2a896550af7f)

 app/plug-in/gimppluginmanager-call.c |  1 +
 libgimp/gimp.c                       |  1 +
 libgimpbase/gimpprotocol.c           | 16 ++++++++++++++++
 libgimpbase/gimpprotocol.h           |  5 ++++-
 4 files changed, 22 insertions(+), 1 deletion(-)
---
diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c
index 26f9bea4a9..47791e6f10 100644
--- a/app/plug-in/gimppluginmanager-call.c
+++ b/app/plug-in/gimppluginmanager-call.c
@@ -229,6 +229,7 @@ gimp_plug_in_manager_call_run (GimpPlugInManager   *manager,
       config.tile_cache_size  = gegl_config->tile_cache_size;
       config.swap_path        = gegl_config->swap_path;
       config.num_processors   = gegl_config->num_processors;
+      config.swap_compression = gegl_config->swap_compression;
 
       proc_run.name    = GIMP_PROCEDURE (procedure)->original_name;
       proc_run.nparams = gimp_value_array_length (args);
diff --git a/libgimp/gimp.c b/libgimp/gimp.c
index 9a78e3733a..f0734ff8c8 100644
--- a/libgimp/gimp.c
+++ b/libgimp/gimp.c
@@ -2347,6 +2347,7 @@ gimp_config (GPConfig *config)
   g_object_set (gegl_config (),
                 "tile-cache-size",     config->tile_cache_size,
                 "swap",                path,
+                "swap-compression",    config->swap_compression,
                 "threads",             (gint) config->num_processors,
                 "use-opencl",          config->use_opencl,
                 "application-license", "GPL3",
diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c
index 4ebaa9c637..ded796b2eb 100644
--- a/libgimpbase/gimpprotocol.c
+++ b/libgimpbase/gimpprotocol.c
@@ -566,6 +566,13 @@ _gp_config_read (GIOChannel      *channel,
                                user_data))
     goto cleanup;
 
+  if (config->version < 0x001A)
+    goto end;
+
+  if (! _gimp_wire_read_string (channel,
+                                &config->swap_compression, 1, user_data))
+    goto cleanup;
+
  end:
   msg->data = config;
   return;
@@ -576,6 +583,7 @@ _gp_config_read (GIOChannel      *channel,
   g_free (config->display_name);
   g_free (config->icon_theme_dir);
   g_free (config->swap_path);
+  g_free (config->swap_compression);
   g_slice_free (GPConfig, config);
 }
 
@@ -685,6 +693,13 @@ _gp_config_write (GIOChannel      *channel,
                                 (const guint32 *) &config->num_processors, 1,
                                 user_data))
     return;
+
+  if (config->version < 0x001A)
+    return;
+
+  if (! _gimp_wire_write_string (channel,
+                                 &config->swap_compression, 1, user_data))
+    return;
 }
 
 static void
@@ -699,6 +714,7 @@ _gp_config_destroy (GimpWireMessage *msg)
       g_free (config->display_name);
       g_free (config->icon_theme_dir);
       g_free (config->swap_path);
+      g_free (config->swap_compression);
       g_slice_free (GPConfig, config);
     }
 }
diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h
index 3c7dc44d3e..991abedd0a 100644
--- a/libgimpbase/gimpprotocol.h
+++ b/libgimpbase/gimpprotocol.h
@@ -26,7 +26,7 @@ G_BEGIN_DECLS
 
 /* Increment every time the protocol changes
  */
-#define GIMP_PROTOCOL_VERSION  0x0019
+#define GIMP_PROTOCOL_VERSION  0x001A
 
 
 enum
@@ -90,6 +90,9 @@ struct _GPConfig
   guint64  tile_cache_size;
   gchar   *swap_path;
   gint32   num_processors;
+
+  /* since protocol version 0x001a: */
+  gchar   *swap_compression;
 };
 
 struct _GPTileReq


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