[gimp] plug-ins: rename all boolean comment arguments to "save-comment"



commit 9326f4a76c2e22bca5dca71bb62a6b1624336395
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 10 01:32:28 2019 +0200

    plug-ins: rename all boolean comment arguments to "save-comment"
    
    and let them default to gimp_export_comment(). Set the default value
    of all "comment" arguments to gimp_get_default_comment().

 plug-ins/common/file-csource.c | 22 +++++++++++-----------
 plug-ins/common/file-png.c     | 27 +++++----------------------
 plug-ins/common/file-xbm.c     | 18 +++++++++---------
 plug-ins/file-jpeg/jpeg.c      |  2 +-
 4 files changed, 26 insertions(+), 43 deletions(-)
---
diff --git a/plug-ins/common/file-csource.c b/plug-ins/common/file-csource.c
index dd3077309b..36c9e44648 100644
--- a/plug-ins/common/file-csource.c
+++ b/plug-ins/common/file-csource.c
@@ -143,13 +143,13 @@ csource_create_procedure (GimpPlugIn  *plug_in,
       GIMP_PROC_AUX_ARG_STRING (procedure, "comment",
                                 "Comment",
                                 "Comment",
-                                NULL,
+                                gimp_get_default_comment (),
                                 GIMP_PARAM_READWRITE);
 
-      GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "use-comment",
-                                 "Use comment",
-                                 "Use comment",
-                                 FALSE,
+      GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "save-comment",
+                                 "Save comment",
+                                 "Save comment",
+                                 gimp_export_comment (),
                                  GIMP_PARAM_READWRITE);
 
       GIMP_PROC_AUX_ARG_BOOLEAN (procedure, "glib-types",
@@ -547,7 +547,7 @@ save_image (GFile         *file,
   gint           drawable_bpp;
   gchar         *config_prefixed_name;
   gchar         *config_comment;
-  gboolean       config_use_comment;
+  gboolean       config_save_comment;
   gboolean       config_glib_types;
   gboolean       config_save_alpha;
   gboolean       config_rgb565;
@@ -558,7 +558,7 @@ save_image (GFile         *file,
   g_object_get (config,
                 "prefixed-name", &config_prefixed_name,
                 "comment",       &config_comment,
-                "use-comment",   &config_use_comment,
+                "save-comment",  &config_save_comment,
                 "glib-types",    &config_glib_types,
                 "save-alpha",    &config_save_alpha,
                 "rgb565",        &config_rgb565,
@@ -736,7 +736,7 @@ save_image (GFile         *file,
                    s_uint, s_uint, s_uint))
         goto fail;
 
-      if (config_use_comment)
+      if (config_save_comment)
         {
           if (! print (output, error, "  %s\t*comment;\n", s_char))
             goto fail;
@@ -789,7 +789,7 @@ save_image (GFile         *file,
         }
     }
 
-  if (config_use_comment && ! config_comment)
+  if (config_save_comment && ! config_comment)
     {
       if (! config_use_macros)
         {
@@ -804,7 +804,7 @@ save_image (GFile         *file,
             goto fail;
         }
     }
-  else if (config_use_comment)
+  else if (config_save_comment)
     {
       gchar *p = config_comment - 1;
 
@@ -1010,7 +1010,7 @@ save_dialog (GimpProcedure *procedure,
 
   /* Use Comment
    */
-  toggle = gimp_prop_check_button_new (config, "use-comment",
+  toggle = gimp_prop_check_button_new (config, "save-comment",
                                        _("_Save comment to file"));
   gtk_box_pack_start (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
 
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 1a99645e2e..fbc67ef058 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -19,23 +19,6 @@
  *
  *   You should have received a copy of the GNU General Public License
  *   along with this program.  If not, see <https://www.gnu.org/licenses/>.
- *
- * Contents:
- *
- *   main()                      - Main entry - just call gimp_main()...
- *   query()                     - Respond to a plug-in query...
- *   run()                       - Run the plug-in...
- *   load_image()                - Load a PNG image into a new image window.
- *   offsets_dialog()            - Asks the user about offsets when loading.
- *   respin_cmap()               - Re-order a Gimp colormap for PNG tRNS
- *   save_image()                - Export the specified image to a PNG file.
- *   save_compression_callback() - Update the image compression level.
- *   save_interlace_update()     - Update the interlacing option.
- *   save_dialog()               - Pop up the export dialog.
- *
- * Revision History:
- *
- *   see ChangeLog
  */
 
 #include "config.h"
@@ -281,10 +264,10 @@ png_create_procedure (GimpPlugIn  *plug_in,
                              TRUE,
                              G_PARAM_READWRITE);
 
-      GIMP_PROC_ARG_BOOLEAN (procedure, "comment",
-                             "Comment",
+      GIMP_PROC_ARG_BOOLEAN (procedure, "save-comment",
+                             "Save comment",
                              "Write comment?",
-                             TRUE,
+                             gimp_export_comment (),
                              G_PARAM_READWRITE);
 
       GIMP_PROC_ARG_BOOLEAN (procedure, "save-transparent",
@@ -1282,7 +1265,7 @@ save_image (GFile        *file,
                 "offs",               &save_offs,
                 "phys",               &save_phys,
                 "time",               &save_time,
-                "comment",            &save_comment,
+                "save-comment",       &save_comment,
                 "save-transparent",   &save_transp_pixels,
                 "compression",        &compression_level,
                 "format",             &export_format,
@@ -2264,7 +2247,7 @@ save_dialog (GimpImage     *image,
   col = 1;
   row = 0;
 
-  button = gimp_prop_check_button_new (config, "comment",
+  button = gimp_prop_check_button_new (config, "save-comment",
                                        _("Save comme_nt"));
   gtk_grid_attach (GTK_GRID (grid), button, col, row++, 1, 1);
 
diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c
index 545eca9b22..dbe3c262dd 100644
--- a/plug-ins/common/file-xbm.c
+++ b/plug-ins/common/file-xbm.c
@@ -202,16 +202,16 @@ xbm_create_procedure (GimpPlugIn  *plug_in,
       gimp_file_procedure_set_extensions (GIMP_FILE_PROCEDURE (procedure),
                                           "xbm,icon,bitmap");
 
-      GIMP_PROC_ARG_BOOLEAN (procedure, "use-comment",
-                             "Use comment",
+      GIMP_PROC_ARG_BOOLEAN (procedure, "save-comment",
+                             "Save comment",
                              _("Write a comment at the beginning of the file."),
-                             FALSE,
+                             FALSE, /* *NOT* gimp_export_comment() */
                              G_PARAM_READWRITE);
 
       GIMP_PROC_ARG_STRING (procedure, "comment",
                             "Comment",
                             "Image description (maximum 72 bytes)",
-                            "Created with GIMP",
+                            gimp_get_default_comment (),
                             G_PARAM_READWRITE);
 
       GIMP_PROC_ARG_BOOLEAN (procedure, "x10-format",
@@ -980,7 +980,7 @@ save_image (GFile         *file,
   guchar        *data = NULL;
   guchar        *cmap;
   const gchar   *intfmt;
-  gboolean       config_use_comment;
+  gboolean       config_save_comment;
   gchar         *config_comment;
   gint           config_x10_format;
   gint           config_use_hot;
@@ -988,7 +988,7 @@ save_image (GFile         *file,
   gint           config_y_hot;
 
   g_object_get (config,
-                "use-comment",  &config_use_comment,
+                "save-comment", &config_save_comment,
                 "comment",      &config_comment,
                 "x10-format",   &config_x10_format,
                 "use-hot-spot", &config_use_hot,
@@ -1065,7 +1065,7 @@ save_image (GFile         *file,
     }
 
   /* Maybe write the image comment. */
-  if (config_use_comment && config_comment && *config_comment)
+  if (config_save_comment && config_comment && *config_comment)
     {
       if (! print (output, error, "/* %s */\n", config_comment))
         goto fail;
@@ -1278,7 +1278,7 @@ save_dialog (GimpDrawable  *drawable,
   gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
   gtk_widget_show (frame);
 
-  toggle = gimp_prop_check_button_new (config, "use-comment",
+  toggle = gimp_prop_check_button_new (config, "save-comment",
                                        _("_Write comment"));
   gtk_frame_set_label_widget (GTK_FRAME (frame), toggle);
 
@@ -1298,7 +1298,7 @@ save_dialog (GimpDrawable  *drawable,
   gtk_grid_attach (GTK_GRID (grid), hint, 0, 0, 2, 1);
   gtk_widget_show (hint);
 
-  g_object_bind_property (config, "use-comment",
+  g_object_bind_property (config, "save-comment",
                           grid,   "sensitive",
                           G_BINDING_SYNC_CREATE);
 
diff --git a/plug-ins/file-jpeg/jpeg.c b/plug-ins/file-jpeg/jpeg.c
index 957e3095e2..987477d3db 100644
--- a/plug-ins/file-jpeg/jpeg.c
+++ b/plug-ins/file-jpeg/jpeg.c
@@ -223,7 +223,7 @@ jpeg_create_procedure (GimpPlugIn  *plug_in,
       GIMP_PROC_ARG_STRING (procedure, "comment",
                             "Comment",
                             "Image comment",
-                            NULL,
+                            gimp_get_default_comment (),
                             G_PARAM_READWRITE);
 
       GIMP_PROC_ARG_INT (procedure, "sub-sampling",


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