[gimp] libgimp: remove underscores from the procedure conifig load/save functions



commit e1a9b9242efc553bfa27b27d4809ed5e4a82eb4c
Author: Michael Natterer <mitch gimp org>
Date:   Sat Sep 28 20:51:16 2019 +0200

    libgimp: remove underscores from the procedure conifig load/save functions
    
    They are needed by GimpProcedureDialog wich is in libgimp. Keep them
    in the private header anyway for now.

 libgimp/gimp.def                      |  6 +++
 libgimp/gimpprocedure.c               |  2 +-
 libgimp/gimpprocedureconfig-private.h | 27 +++++++------
 libgimp/gimpprocedureconfig.c         | 74 ++++++++++++++++++++++++-----------
 libgimp/gimpproceduredialog.c         |  4 +-
 5 files changed, 75 insertions(+), 38 deletions(-)
---
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index ae87bf74f4..e146895ab2 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -687,6 +687,12 @@ EXPORTS
        gimp_procedure_config_get_procedure
        gimp_procedure_config_get_type
        gimp_procedure_config_get_values
+       gimp_procedure_config_load_default
+       gimp_procedure_config_load_last
+       gimp_procedure_config_load_parasite
+       gimp_procedure_config_save_default
+       gimp_procedure_config_save_last
+       gimp_procedure_config_save_parasite
        gimp_procedure_config_set_values
        gimp_procedure_create_config
        gimp_procedure_extension_ready
diff --git a/libgimp/gimpprocedure.c b/libgimp/gimpprocedure.c
index 86829bbd99..e84d6272a8 100644
--- a/libgimp/gimpprocedure.c
+++ b/libgimp/gimpprocedure.c
@@ -1587,7 +1587,7 @@ gimp_procedure_run (GimpProcedure  *procedure,
 
       /*  if saved defaults exist, they override GParamSpec  */
       config = gimp_procedure_create_config (procedure);
-      if (_gimp_procedure_config_load_default (config, NULL))
+      if (gimp_procedure_config_load_default (config, NULL))
         config_class = G_OBJECT_GET_CLASS (config);
       else
         g_clear_object (&config);
diff --git a/libgimp/gimpprocedureconfig-private.h b/libgimp/gimpprocedureconfig-private.h
index 8db3d11425..3d5a8ff11f 100644
--- a/libgimp/gimpprocedureconfig-private.h
+++ b/libgimp/gimpprocedureconfig-private.h
@@ -23,21 +23,22 @@
 #define __GIMP_PROCEDURE_CONFIG_PRIVATE_H__
 
 
-gboolean   _gimp_procedure_config_load_default  (GimpProcedureConfig  *config,
-                                                 GError              **error);
-gboolean   _gimp_procedure_config_save_default  (GimpProcedureConfig  *config,
-                                                 GError              **error);
+gboolean   gimp_procedure_config_load_default  (GimpProcedureConfig  *config,
+                                                GError              **error);
+gboolean   gimp_procedure_config_save_default  (GimpProcedureConfig  *config,
+                                                GError              **error);
 
-gboolean   _gimp_procedure_config_load_last     (GimpProcedureConfig  *config,
-                                                 GError              **error);
-gboolean   _gimp_procedure_config_save_last     (GimpProcedureConfig  *config,
-                                                 GError              **error);
+gboolean   gimp_procedure_config_load_last     (GimpProcedureConfig  *config,
+                                                GError              **error);
+gboolean   gimp_procedure_config_save_last     (GimpProcedureConfig  *config,
+                                                GError              **error);
 
-gboolean   _gimp_procedure_config_load_parasite (GimpProcedureConfig  *config,
-                                                 GimpImage            *image,
-                                                 GError              **error);
-gboolean   _gimp_procedure_config_save_parasite (GimpProcedureConfig  *config,
-                                                 GimpImage            *image);
+gboolean   gimp_procedure_config_load_parasite (GimpProcedureConfig  *config,
+                                                GimpImage            *image,
+                                                GError              **error);
+gboolean   gimp_procedure_config_save_parasite (GimpProcedureConfig  *config,
+                                                GimpImage            *image,
+                                                GError              **error);
 
 
 #endif /* __GIMP_PROCEDURE_CONFIG_PRIVATE_H__ */
diff --git a/libgimp/gimpprocedureconfig.c b/libgimp/gimpprocedureconfig.c
index 7c8c902004..5622a2eb1d 100644
--- a/libgimp/gimpprocedureconfig.c
+++ b/libgimp/gimpprocedureconfig.c
@@ -342,8 +342,8 @@ gimp_procedure_config_begin_run (GimpProcedureConfig  *config,
     case GIMP_RUN_WITH_LAST_VALS:
       if (image)
         {
-          loaded = _gimp_procedure_config_load_parasite (config, image,
-                                                         &error);
+          loaded = gimp_procedure_config_load_parasite (config, image,
+                                                        &error);
           if (! loaded && error)
             {
               g_printerr ("Loading last used values from parasite failed: %s\n",
@@ -353,7 +353,7 @@ gimp_procedure_config_begin_run (GimpProcedureConfig  *config,
         }
 
       if (! loaded &&
-          ! _gimp_procedure_config_load_last (config, &error) && error)
+          ! gimp_procedure_config_load_last (config, &error) && error)
         {
           g_printerr ("Loading last used values from disk failed: %s\n",
                       error->message);
@@ -406,9 +406,10 @@ gimp_procedure_config_end_run (GimpProcedureConfig *config,
       GError *error = NULL;
 
       if (config->priv->image)
-        _gimp_procedure_config_save_parasite (config, config->priv->image);
+        gimp_procedure_config_save_parasite (config, config->priv->image,
+                                             NULL);
 
-      if (! _gimp_procedure_config_save_last (config, &error))
+      if (! gimp_procedure_config_save_last (config, &error))
         {
           g_printerr ("Saving last used values to disk failed: %s\n",
                       error->message);
@@ -438,12 +439,17 @@ gimp_procedure_config_get_file (GimpProcedureConfig *config,
 }
 
 gboolean
-_gimp_procedure_config_load_default (GimpProcedureConfig  *config,
-                                     GError              **error)
+gimp_procedure_config_load_default (GimpProcedureConfig  *config,
+                                    GError              **error)
 {
-  GFile    *file = gimp_procedure_config_get_file (config, ".default");
+  GFile    *file;
   gboolean  success;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  file = gimp_procedure_config_get_file (config, ".default");
+
   success = gimp_config_deserialize_file (GIMP_CONFIG (config),
                                           file,
                                           NULL, error);
@@ -459,12 +465,17 @@ _gimp_procedure_config_load_default (GimpProcedureConfig  *config,
 }
 
 gboolean
-_gimp_procedure_config_save_default (GimpProcedureConfig  *config,
-                                     GError              **error)
+gimp_procedure_config_save_default (GimpProcedureConfig  *config,
+                                    GError              **error)
 {
-  GFile    *file = gimp_procedure_config_get_file (config, ".default");
+  GFile    *file;
   gboolean  success;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  file = gimp_procedure_config_get_file (config, ".default");
+
   success = gimp_config_serialize_to_file (GIMP_CONFIG (config),
                                            file,
                                            "settings",
@@ -477,12 +488,17 @@ _gimp_procedure_config_save_default (GimpProcedureConfig  *config,
 }
 
 gboolean
-_gimp_procedure_config_load_last (GimpProcedureConfig  *config,
-                                  GError              **error)
+gimp_procedure_config_load_last (GimpProcedureConfig  *config,
+                                 GError              **error)
 {
-  GFile    *file = gimp_procedure_config_get_file (config, ".last");
+  GFile    *file;
   gboolean  success;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  file = gimp_procedure_config_get_file (config, ".last");
+
   success = gimp_config_deserialize_file (GIMP_CONFIG (config),
                                           file,
                                           NULL, error);
@@ -498,12 +514,17 @@ _gimp_procedure_config_load_last (GimpProcedureConfig  *config,
 }
 
 gboolean
-_gimp_procedure_config_save_last (GimpProcedureConfig  *config,
-                                  GError              **error)
+gimp_procedure_config_save_last (GimpProcedureConfig  *config,
+                                 GError              **error)
 {
-  GFile    *file = gimp_procedure_config_get_file (config, ".last");
+  GFile    *file;
   gboolean  success;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
+  file = gimp_procedure_config_get_file (config, ".last");
+
   success = gimp_config_serialize_to_file (GIMP_CONFIG (config),
                                            file,
                                            "settings",
@@ -523,14 +544,18 @@ gimp_procedure_config_parasite_name (GimpProcedureConfig *config,
 }
 
 gboolean
-_gimp_procedure_config_load_parasite (GimpProcedureConfig  *config,
-                                      GimpImage            *image,
-                                      GError              **error)
+gimp_procedure_config_load_parasite (GimpProcedureConfig  *config,
+                                     GimpImage            *image,
+                                     GError              **error)
 {
   gchar        *name;
   GimpParasite *parasite;
   gboolean      success;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
   name = gimp_procedure_config_parasite_name (config, "-last");
   parasite = gimp_image_get_parasite (image, name);
   g_free (name);
@@ -547,12 +572,17 @@ _gimp_procedure_config_load_parasite (GimpProcedureConfig  *config,
 }
 
 gboolean
-_gimp_procedure_config_save_parasite (GimpProcedureConfig *config,
-                                      GimpImage           *image)
+gimp_procedure_config_save_parasite (GimpProcedureConfig  *config,
+                                     GimpImage            *image,
+                                     GError              **error)
 {
   gchar        *name;
   GimpParasite *parasite;
 
+  g_return_val_if_fail (GIMP_IS_PROCEDURE_CONFIG (config), FALSE);
+  g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
+  g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
+
   name = gimp_procedure_config_parasite_name (config, "-last");
   parasite = gimp_config_serialize_to_parasite (GIMP_CONFIG (config),
                                                 name,
diff --git a/libgimp/gimpproceduredialog.c b/libgimp/gimpproceduredialog.c
index 594969323e..5b29f387e2 100644
--- a/libgimp/gimpproceduredialog.c
+++ b/libgimp/gimpproceduredialog.c
@@ -348,7 +348,7 @@ gimp_procedure_dialog_load_defaults (GtkWidget           *button,
 {
   GError *error = NULL;
 
-  if (! _gimp_procedure_config_load_default (dialog->priv->config, &error))
+  if (! gimp_procedure_config_load_default (dialog->priv->config, &error))
     {
       if (error)
         {
@@ -369,7 +369,7 @@ gimp_procedure_dialog_save_defaults (GtkWidget           *button,
 {
   GError *error = NULL;
 
-  if (! _gimp_procedure_config_save_default (dialog->priv->config, &error))
+  if (! gimp_procedure_config_save_default (dialog->priv->config, &error))
     {
       g_printerr ("Saving default values to disk failed: %s\n",
                   error->message);


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