[gimp] plug-ins: start the progress before opening files for loading/saving



commit f28878b6d3e075f92ae36b137116cacd500919cb
Author: Michael Natterer <mitch gimp org>
Date:   Wed Jul 23 16:39:00 2014 +0200

    plug-ins: start the progress before opening files for loading/saving
    
    so the user gets feedback as early as possible.

 plug-ins/common/file-cel.c         |   11 +++++------
 plug-ins/common/file-dicom.c       |    7 +++----
 plug-ins/common/file-gbr.c         |   12 ++++++------
 plug-ins/common/file-gif-load.c    |    6 +++---
 plug-ins/common/file-gif-save.c    |   10 +++++-----
 plug-ins/common/file-gih.c         |   12 ++++++------
 plug-ins/common/file-html-table.c  |    6 +++---
 plug-ins/common/file-pat.c         |   12 ++++++------
 plug-ins/common/file-pcx.c         |    6 +++---
 plug-ins/common/file-pix.c         |   12 ++++++------
 plug-ins/common/file-png.c         |   12 ++++++------
 plug-ins/common/file-pnm.c         |   13 ++++++-------
 plug-ins/common/file-ps.c          |   12 ++++++------
 plug-ins/common/file-raw-data.c    |    6 +++---
 plug-ins/common/file-sunras.c      |   12 ++++++------
 plug-ins/common/file-tga.c         |   12 ++++++------
 plug-ins/common/file-wmf.c         |    6 +++---
 plug-ins/common/file-xbm.c         |   12 ++++++------
 plug-ins/common/file-xmc.c         |   12 ++++++------
 plug-ins/common/file-xwd.c         |   12 ++++++------
 plug-ins/file-bmp/bmp-read.c       |    6 +++---
 plug-ins/file-bmp/bmp-write.c      |    8 ++++----
 plug-ins/file-exr/file-exr.c       |    6 +++---
 plug-ins/file-fits/fits.c          |    6 +++---
 plug-ins/file-fli/fli-gimp.c       |    6 +++---
 plug-ins/file-jpeg/jpeg-load.c     |    7 +++----
 plug-ins/file-psd/psd-load.c       |    6 +++---
 plug-ins/file-psd/psd-save.c       |    5 ++---
 plug-ins/file-psd/psd-thumb-load.c |    6 +++---
 plug-ins/file-sgi/sgi.c            |   12 ++++++------
 30 files changed, 133 insertions(+), 138 deletions(-)
---
diff --git a/plug-ins/common/file-cel.c b/plug-ins/common/file-cel.c
index 9ee3a96..f899579 100644
--- a/plug-ins/common/file-cel.c
+++ b/plug-ins/common/file-cel.c
@@ -335,6 +335,8 @@ load_image (const gchar  *file,
   gint        i, j, k;       /* Counters */
   size_t      n_read;        /* Number of items read from file */
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (file));
 
   /* Open the file for reading */
   fp = g_fopen (file, "r");
@@ -347,9 +349,6 @@ load_image (const gchar  *file,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (file));
-
   /* Get the image dimensions and create the image... */
 
   n_read = fread (header, 4, 1, fp);
@@ -769,6 +768,9 @@ save_image (const gchar  *file,
   width  = gegl_buffer_get_width  (buffer);
   height = gegl_buffer_get_height (buffer);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (file));
+
   /* Open the file for writing */
   fp = g_fopen (file, "w");
 
@@ -780,9 +782,6 @@ save_image (const gchar  *file,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (file));
-
   /* Headers */
   memset (header, 0, 32);
   strcpy ((gchar *) header, "KiSS");
diff --git a/plug-ins/common/file-dicom.c b/plug-ins/common/file-dicom.c
index a40e04a..90cea8d 100644
--- a/plug-ins/common/file-dicom.c
+++ b/plug-ins/common/file-dicom.c
@@ -331,7 +331,9 @@ load_image (const gchar  *filename,
   gboolean        is_signed         = FALSE;
   guint8          in_sequence       = 0;
 
-  /* open the file */
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   DICOM = g_fopen (filename, "rb");
 
   if (! DICOM)
@@ -342,9 +344,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* allocate the necessary structures */
   dicominfo = g_new0 (DicomInfo, 1);
 
diff --git a/plug-ins/common/file-gbr.c b/plug-ins/common/file-gbr.c
index 82f781e..53b0a64 100644
--- a/plug-ins/common/file-gbr.c
+++ b/plug-ins/common/file-gbr.c
@@ -345,13 +345,13 @@ load_image (GFile   *file,
   gsize              size;
   gint               i;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             g_file_get_parse_name (file));
+
   input = G_INPUT_STREAM (g_file_read (file, NULL, error));
   if (! input)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             g_file_get_parse_name (file));
-
   size = G_STRUCT_OFFSET (BrushHeader, magic_number);
 
   if (! g_input_stream_read_all (input, &bh, size,
@@ -671,13 +671,13 @@ save_image (GFile   *file,
 
   bpp = babl_format_get_bytes_per_pixel (format);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             g_file_get_parse_name (file));
+
   output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, error));
   if (! output)
     return FALSE;
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             g_file_get_parse_name (file));
-
   buffer = gimp_drawable_get_buffer (drawable_ID);
 
   width  = gimp_drawable_width  (drawable_ID);
diff --git a/plug-ins/common/file-gif-load.c b/plug-ins/common/file-gif-load.c
index d71e984..084ad27 100644
--- a/plug-ins/common/file-gif-load.c
+++ b/plug-ins/common/file-gif-load.c
@@ -348,6 +348,9 @@ load_image (const gchar  *filename,
   gchar     version[4];
   gint32    image_ID = -1;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fd = g_fopen (filename, "rb");
 
   if (! fd)
@@ -358,9 +361,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   if (! ReadOK (fd, buf, 6))
     {
       g_message ("Error reading magic number");
diff --git a/plug-ins/common/file-gif-save.c b/plug-ins/common/file-gif-save.c
index 1847d98..90c43ae 100644
--- a/plug-ins/common/file-gif-save.c
+++ b/plug-ins/common/file-gif-save.c
@@ -791,6 +791,11 @@ save_image (const gchar *filename,
     }
 
 
+  /* init the progress meter */
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
+
   /* open the destination file for writing */
   outfile = g_fopen (filename, "wb");
   if (!outfile)
@@ -802,11 +807,6 @@ save_image (const gchar *filename,
     }
 
 
-  /* init the progress meter */
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
-
   /* write the GIFheader */
 
   if (colors < 256)
diff --git a/plug-ins/common/file-gih.c b/plug-ins/common/file-gih.c
index 6bd704e..390b680 100644
--- a/plug-ins/common/file-gih.c
+++ b/plug-ins/common/file-gih.c
@@ -662,13 +662,13 @@ gih_load_image (GFile   *file,
   GimpParasite *pipe_parasite;
   gsize         bytes_read;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             g_file_get_parse_name (file));
+
   input = G_INPUT_STREAM (g_file_read (file, NULL, error));
   if (! input)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             g_file_get_parse_name (file));
-
   /* The file format starts with a painfully simple text header */
 
   /*  get the name  */
@@ -1294,13 +1294,13 @@ gih_save_image (GFile    *file,
   imagew = gimp_image_width (image_ID);
   imageh = gimp_image_height (image_ID);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             g_file_get_parse_name (file));
+
   output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, error));
   if (! output)
     return FALSE;
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             g_file_get_parse_name (file));
-
   parstring = gimp_pixpipe_params_build (&gihparams);
 
   header = g_strdup_printf ("%s\n%d %s\n",
diff --git a/plug-ins/common/file-html-table.c b/plug-ins/common/file-html-table.c
index 54579ef..81a4902 100644
--- a/plug-ins/common/file-html-table.c
+++ b/plug-ins/common/file-html-table.c
@@ -233,6 +233,9 @@ save_image (const gchar  *filename,
   cols = gegl_buffer_get_width  (buffer);
   rows = gegl_buffer_get_height (buffer);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fp = g_fopen (filename, "w");
 
   if (! fp)
@@ -260,9 +263,6 @@ save_image (const gchar  *filename,
     fprintf (fp, "<CAPTION>%s</CAPTION>\n",
              gtmvals.captiontxt);
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   buf  = g_newa (guchar, babl_format_get_bytes_per_pixel (format));
   buf2 = g_newa (guchar, babl_format_get_bytes_per_pixel (format));
 
diff --git a/plug-ins/common/file-pat.c b/plug-ins/common/file-pat.c
index ec4666c..be2cf66 100644
--- a/plug-ins/common/file-pat.c
+++ b/plug-ins/common/file-pat.c
@@ -317,13 +317,13 @@ load_image (GFile   *file,
   GimpImageType     image_type;
   gsize             bytes_read;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             g_file_get_parse_name (file));
+
   input = G_INPUT_STREAM (g_file_read (file, NULL, error));
   if (! input)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             g_file_get_parse_name (file));
-
   if (! g_input_stream_read_all (input, &ph, sizeof (PatternHeader),
                                  &bytes_read, NULL, error) ||
       bytes_read != sizeof (PatternHeader))
@@ -515,13 +515,13 @@ save_image (GFile   *file,
       return FALSE;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             g_file_get_parse_name (file));
+
   output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, error));
   if (! output)
     return FALSE;
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             g_file_get_parse_name (file));
-
   buffer = gimp_drawable_get_buffer (drawable_ID);
 
   width  = gegl_buffer_get_width (buffer);
diff --git a/plug-ins/common/file-pcx.c b/plug-ins/common/file-pcx.c
index e3f495b..4fab4f7 100644
--- a/plug-ins/common/file-pcx.c
+++ b/plug-ins/common/file-pcx.c
@@ -356,6 +356,9 @@ load_image (const gchar  *filename,
   guchar       *dest, cmap[768];
   guint8        header_buf[128];
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fd = g_fopen (filename, "rb");
 
   if (! fd)
@@ -366,9 +369,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   if (fread (header_buf, 128, 1, fd) == 0)
     {
       g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED,
diff --git a/plug-ins/common/file-pix.c b/plug-ins/common/file-pix.c
index 015a34a..2110d91 100644
--- a/plug-ins/common/file-pix.c
+++ b/plug-ins/common/file-pix.c
@@ -357,13 +357,13 @@ load_image (GFile   *file,
 
   PIX_DEBUG_PRINT ("Opening file: %s\n", filename);
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             g_file_get_parse_name (file));
+
   input = G_INPUT_STREAM (g_file_read (file, NULL, error));
   if (! input)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             g_file_get_parse_name (file));
-
   /* Read header information */
   if (! get_short (input, &width,  error) ||
       ! get_short (input, &height, error) ||
@@ -536,13 +536,13 @@ save_image (GFile   *file,
   guchar        *src;
   guchar        *src_base;
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             g_file_get_parse_name (file));
+
   output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, error));
   if (! output)
     return FALSE;
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             g_file_get_parse_name (file));
-
   /* Get info about image */
   buffer = gimp_drawable_get_buffer (drawable_ID);
 
diff --git a/plug-ins/common/file-png.c b/plug-ins/common/file-png.c
index 876de60..44d7aac 100644
--- a/plug-ins/common/file-png.c
+++ b/plug-ins/common/file-png.c
@@ -855,6 +855,9 @@ load_image (const gchar  *filename,
    * Open the file and initialize the PNG read "engine"...
    */
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fp = g_fopen (filename, "rb");
 
   if (fp == NULL)
@@ -867,9 +870,6 @@ load_image (const gchar  *filename,
 
   png_init_io (pp, fp);
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /*
    * Get the image dimensions and create the image...
    */
@@ -1480,6 +1480,9 @@ save_image (const gchar  *filename,
    * Open the file and initialize the PNG write "engine"...
    */
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fp = g_fopen (filename, "wb");
   if (fp == NULL)
     {
@@ -1491,9 +1494,6 @@ save_image (const gchar  *filename,
 
   png_init_io (pp, fp);
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /*
    * Get the buffer for the current image...
    */
diff --git a/plug-ins/common/file-pnm.c b/plug-ins/common/file-pnm.c
index 78e0684..0b665be 100644
--- a/plug-ins/common/file-pnm.c
+++ b/plug-ins/common/file-pnm.c
@@ -494,14 +494,13 @@ load_image (GFile   *file,
   PNMScanner      *volatile scan;
   int             ctr;
 
-  /* open the file */
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             g_file_get_parse_name (file));
+
   input = G_INPUT_STREAM (g_file_read (file, NULL, error));
   if (! input)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             g_file_get_parse_name (file));
-
   /* allocate the necessary structures */
   pnminfo = g_new (PNMInfo, 1);
 
@@ -1052,14 +1051,14 @@ save_image (GFile     *file,
       return FALSE;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             g_file_get_parse_name (file));
+
   /* open the file */
   output = G_OUTPUT_STREAM (g_file_replace (file, NULL, FALSE, 0, NULL, error));
   if (! output)
     return FALSE;
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             g_file_get_parse_name (file));
-
   buffer = gimp_drawable_get_buffer (drawable_ID);
 
   xres = gegl_buffer_get_width  (buffer);
diff --git a/plug-ins/common/file-ps.c b/plug-ins/common/file-ps.c
index c254def..d5a0a88 100644
--- a/plug-ins/common/file-ps.c
+++ b/plug-ins/common/file-ps.c
@@ -1011,6 +1011,9 @@ load_image (const gchar  *filename,
   g_print (" GraphicsAlphaBits: %d\n", plvals.graphicsalpha);
 #endif
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Try to see if PostScript file is available */
   ifp = g_fopen (filename, "r");
   if (ifp == NULL)
@@ -1022,9 +1025,6 @@ load_image (const gchar  *filename,
     }
   fclose (ifp);
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf);
   if (!ifp)
     {
@@ -1187,6 +1187,9 @@ save_image (const gchar  *filename,
       break;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Open the output file. */
   ofp = g_fopen (filename, "wb");
   if (!ofp)
@@ -1197,9 +1200,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   save_ps_header (ofp, filename);
 
   switch (drawable_type)
diff --git a/plug-ins/common/file-raw-data.c b/plug-ins/common/file-raw-data.c
index 448218e..0b1732c 100644
--- a/plug-ins/common/file-raw-data.c
+++ b/plug-ins/common/file-raw-data.c
@@ -899,6 +899,9 @@ load_image (const gchar  *filename,
 
   data = g_new0 (RawGimpData, 1);
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   data->fp = g_fopen (filename, "rb");
   if (! data->fp)
     {
@@ -908,9 +911,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   size = get_file_info (filename);
 
   switch (runtime->image_type)
diff --git a/plug-ins/common/file-sunras.c b/plug-ins/common/file-sunras.c
index adcf622..884e8c6 100644
--- a/plug-ins/common/file-sunras.c
+++ b/plug-ins/common/file-sunras.c
@@ -426,6 +426,9 @@ load_image (const gchar  *filename,
   L_SUNFILEHEADER  sunhdr;
   guchar          *suncolmap = NULL;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   ifp = g_fopen (filename, "rb");
   if (!ifp)
     {
@@ -526,9 +529,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   switch (sunhdr.l_ras_depth)
     {
     case 1:    /* bitmap */
@@ -599,6 +599,9 @@ save_image (const gchar  *filename,
       break;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Open the output file. */
   ofp = g_fopen (filename, "wb");
   if (! ofp)
@@ -609,9 +612,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   if (drawable_type == GIMP_INDEXED_IMAGE)
     retval = save_index (ofp,image_ID, drawable_ID, FALSE, psvals.rle);
   else if (drawable_type == GIMP_GRAY_IMAGE)
diff --git a/plug-ins/common/file-tga.c b/plug-ins/common/file-tga.c
index 5024305..7b11baa 100644
--- a/plug-ins/common/file-tga.c
+++ b/plug-ins/common/file-tga.c
@@ -435,6 +435,9 @@ load_image (const gchar  *filename,
   long      offset;
   gint32    image_ID = -1;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fp = g_fopen (filename, "rb");
 
   if (! fp)
@@ -445,9 +448,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* Is file big enough for a footer? */
   if (!fseek (fp, -26L, SEEK_END))
     {
@@ -1173,6 +1173,9 @@ save_image (const gchar  *filename,
   width  = gegl_buffer_get_width  (buffer);
   height = gegl_buffer_get_height (buffer);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   if ((fp = g_fopen (filename, "wb")) == NULL)
     {
       g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errno),
@@ -1181,9 +1184,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   header[0] = 0; /* No image identifier / description */
 
   if (dtype == GIMP_INDEXED_IMAGE)
diff --git a/plug-ins/common/file-wmf.c b/plug-ins/common/file-wmf.c
index 5c9b34a..09855df 100644
--- a/plug-ins/common/file-wmf.c
+++ b/plug-ins/common/file-wmf.c
@@ -982,14 +982,14 @@ load_image (const gchar  *filename,
   guchar       *pixels;
   guint         width, height;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   pixels = wmf_load_file (filename, &width, &height, error);
 
   if (! pixels)
     return -1;
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   image = gimp_image_new (width, height, GIMP_RGB);
   gimp_image_set_filename (image, filename);
   gimp_image_set_resolution (image,
diff --git a/plug-ins/common/file-xbm.c b/plug-ins/common/file-xbm.c
index 73ae5ab..e99e45c 100644
--- a/plug-ins/common/file-xbm.c
+++ b/plug-ins/common/file-xbm.c
@@ -731,6 +731,9 @@ load_image (const gchar  *filename,
     0xff, 0xff, 0xff            /* white */
   };
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   fp = g_fopen (filename, "rb");
   if (! fp)
     {
@@ -740,9 +743,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   comment = fgetcomment (fp);
 
   /* Loosely parse the header */
@@ -1023,6 +1023,9 @@ save_image (const gchar  *filename,
         dark = 1;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Now actually save the data. */
   fp = g_fopen (filename, "w");
   if (! fp)
@@ -1033,9 +1036,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* Maybe write the image comment. */
 #if 0
   /* DISABLED - see http://bugzilla.gnome.org/show_bug.cgi?id=82763 */
diff --git a/plug-ins/common/file-xmc.c b/plug-ins/common/file-xmc.c
index 09c66e9..c5f2513 100644
--- a/plug-ins/common/file-xmc.c
+++ b/plug-ins/common/file-xmc.c
@@ -646,6 +646,9 @@ load_image (const gchar  *filename,
   gint             img_height;
   gint             i, j;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Open the file and check it is a valid X cursor */
 
   fp = g_fopen (filename, "rb");
@@ -665,9 +668,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* check dimension is valid. */
 
   for (i = 0; i < imagesp->nimage; i++)
@@ -1451,6 +1451,9 @@ save_image (const gchar *filename,
                     0,
                     NULL);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /*
    * Open the file pointer.
    */
@@ -1464,9 +1467,6 @@ save_image (const gchar *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* get layers */
   orig_layers = gimp_image_get_layers (orig_image_ID, &nlayers);
   layers = gimp_image_get_layers (image_ID, &nlayers);
diff --git a/plug-ins/common/file-xwd.c b/plug-ins/common/file-xwd.c
index 4df9ce8..60b8088 100644
--- a/plug-ins/common/file-xwd.c
+++ b/plug-ins/common/file-xwd.c
@@ -435,6 +435,9 @@ load_image (const gchar  *filename,
   L_XWDFILEHEADER  xwdhdr;
   L_XWDCOLOR      *xwdcolmap = NULL;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   ifp = g_fopen (filename, "rb");
   if (!ifp)
     {
@@ -536,9 +539,6 @@ load_image (const gchar  *filename,
       goto out;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   depth = xwdhdr.l_pixmap_depth;
   bpp   = xwdhdr.l_bits_per_pixel;
 
@@ -638,6 +638,9 @@ save_image (const gchar  *filename,
       break;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Open the output file. */
   ofp = g_fopen (filename, "wb");
   if (! ofp)
@@ -648,9 +651,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   switch (drawable_type)
     {
     case GIMP_INDEXED_IMAGE:
diff --git a/plug-ins/file-bmp/bmp-read.c b/plug-ins/file-bmp/bmp-read.c
index f6d4081..9634055 100644
--- a/plug-ins/file-bmp/bmp-read.c
+++ b/plug-ins/file-bmp/bmp-read.c
@@ -197,6 +197,9 @@ ReadBMP (const gchar  *name,
   gchar     magick[2];
   Bitmap_Channel masks[4];
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (name));
+
   filename = name;
   fd = g_fopen (filename, "rb");
 
@@ -208,9 +211,6 @@ ReadBMP (const gchar  *name,
       goto out;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (name));
-
   /* It is a File. Now is it a Bitmap? Read the shortest possible header */
 
   if (!ReadOK (fd, magick, 2) || !(!strncmp (magick, "BA", 2) ||
diff --git a/plug-ins/file-bmp/bmp-write.c b/plug-ins/file-bmp/bmp-write.c
index 3aa0059..1beaf0c 100644
--- a/plug-ins/file-bmp/bmp-write.c
+++ b/plug-ins/file-bmp/bmp-write.c
@@ -312,6 +312,10 @@ WriteBMP (const gchar  *filename,
 
   gimp_set_data (SAVE_PROC, &BMPSaveData, sizeof (BMPSaveData));
 
+  /* Let's begin the progress */
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Let's take some file */
   outfile = g_fopen (filename, "wb");
   if (!outfile)
@@ -332,10 +336,6 @@ WriteBMP (const gchar  *filename,
 
   g_object_unref (buffer);
 
-  /* And let's begin the progress */
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   cur_progress = 0;
   max_progress = drawable_height;
 
diff --git a/plug-ins/file-exr/file-exr.c b/plug-ins/file-exr/file-exr.c
index 8f3df6d..a155e53 100644
--- a/plug-ins/file-exr/file-exr.c
+++ b/plug-ins/file-exr/file-exr.c
@@ -171,6 +171,9 @@ load_image (const gchar  *filename,
   int end;
   int num;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   loader = exr_loader_new (filename);
   if (!loader)
     {
@@ -227,9 +230,6 @@ load_image (const gchar  *filename,
       goto out;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   image = gimp_image_new_with_precision (width, height,
                                          image_type, image_precision);
   if (image == -1)
diff --git a/plug-ins/file-fits/fits.c b/plug-ins/file-fits/fits.c
index e53e92d..a4d4a4a 100644
--- a/plug-ins/file-fits/fits.c
+++ b/plug-ins/file-fits/fits.c
@@ -470,6 +470,9 @@ save_image (const gchar  *filename,
       break;
     }
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   /* Open the output file. */
   ofp = fits_open (filename, "w");
   if (!ofp)
@@ -480,9 +483,6 @@ save_image (const gchar  *filename,
       return (FALSE);
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   retval = save_fits (ofp,image_ID, drawable_ID);
 
   fits_close (ofp);
diff --git a/plug-ins/file-fli/fli-gimp.c b/plug-ins/file-fli/fli-gimp.c
index 1971600..ae44e96 100644
--- a/plug-ins/file-fli/fli-gimp.c
+++ b/plug-ins/file-fli/fli-gimp.c
@@ -491,6 +491,9 @@ load_image (const gchar  *filename,
   s_fli_header  fli_header;
   gint          cnt;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   file = g_fopen (filename ,"rb");
   if (!file)
     {
@@ -500,9 +503,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   fli_read_header (file, &fli_header);
   if (fli_header.magic == NO_HEADER)
     return -1;
diff --git a/plug-ins/file-jpeg/jpeg-load.c b/plug-ins/file-jpeg/jpeg-load.c
index a264200..40aa0e6 100644
--- a/plug-ins/file-jpeg/jpeg-load.c
+++ b/plug-ins/file-jpeg/jpeg-load.c
@@ -86,6 +86,9 @@ load_image (const gchar  *filename,
   if (!preview)
     {
       jerr.pub.output_message = my_output_message;
+
+      gimp_progress_init_printf (_("Opening '%s'"),
+                                 gimp_filename_to_utf8 (filename));
     }
 
   if ((infile = g_fopen (filename, "rb")) == NULL)
@@ -96,10 +99,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  if (!preview)
-    gimp_progress_init_printf (_("Opening '%s'"),
-                               gimp_filename_to_utf8 (filename));
-
   image_ID = -1;
 
   /* Establish the setjmp return context for my_error_exit to use. */
diff --git a/plug-ins/file-psd/psd-load.c b/plug-ins/file-psd/psd-load.c
index f0be2b3..ee82be1 100644
--- a/plug-ins/file-psd/psd-load.c
+++ b/plug-ins/file-psd/psd-load.c
@@ -122,6 +122,9 @@ load_image (const gchar  *filename,
   if (g_stat (filename, &st) == -1)
     return -1;
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   IFDBG(1) g_debug ("Open file %s", gimp_filename_to_utf8 (filename));
   f = g_fopen (filename, "rb");
   if (f == NULL)
@@ -132,9 +135,6 @@ load_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* ----- Read the PSD file Header block ----- */
   IFDBG(2) g_debug ("Read header block");
   if (read_header_block (&img_a, f, &error) < 0)
diff --git a/plug-ins/file-psd/psd-save.c b/plug-ins/file-psd/psd-save.c
index 239b8a1..376c9a2 100644
--- a/plug-ins/file-psd/psd-save.c
+++ b/plug-ins/file-psd/psd-save.c
@@ -1646,6 +1646,8 @@ save_image (const gchar  *filename,
     }
   g_free (layers);
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
 
   fd = g_fopen (filename, "wb");
   if (fd == NULL)
@@ -1656,9 +1658,6 @@ save_image (const gchar  *filename,
       return FALSE;
     }
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   IFDBG g_print ("\tFile '%s' has been opened\n",
                  gimp_filename_to_utf8 (filename));
 
diff --git a/plug-ins/file-psd/psd-thumb-load.c b/plug-ins/file-psd/psd-thumb-load.c
index 14cde5d..601f51d 100644
--- a/plug-ins/file-psd/psd-thumb-load.c
+++ b/plug-ins/file-psd/psd-thumb-load.c
@@ -71,6 +71,9 @@ load_thumbnail_image (const gchar  *filename,
   if (g_stat (filename, &st) == -1)
     return -1;
 
+  gimp_progress_init_printf (_("Opening thumbnail for '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   IFDBG(1) g_debug ("Open file %s", gimp_filename_to_utf8 (filename));
   f = g_fopen (filename, "rb");
   if (f == NULL)
@@ -81,9 +84,6 @@ load_thumbnail_image (const gchar  *filename,
       return -1;
     }
 
-  gimp_progress_init_printf (_("Opening thumbnail for '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /* ----- Read the PSD file Header block ----- */
   IFDBG(2) g_debug ("Read header block");
   if (read_header_block (&img_a, f, &error) < 0)
diff --git a/plug-ins/file-sgi/sgi.c b/plug-ins/file-sgi/sgi.c
index f13de97..abdb312 100644
--- a/plug-ins/file-sgi/sgi.c
+++ b/plug-ins/file-sgi/sgi.c
@@ -322,6 +322,9 @@ load_image (const gchar  *filename,
   * Open the file for reading...
   */
 
+  gimp_progress_init_printf (_("Opening '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   sgip = sgiOpen (filename, SGI_READ, 0, 0, 0, 0, 0);
   if (sgip == NULL)
     {
@@ -331,9 +334,6 @@ load_image (const gchar  *filename,
       return -1;
     };
 
-  gimp_progress_init_printf (_("Opening '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /*
    * Get the image dimensions and create the image...
    */
@@ -574,6 +574,9 @@ save_image (const gchar  *filename,
    * Open the file for writing...
    */
 
+  gimp_progress_init_printf (_("Saving '%s'"),
+                             gimp_filename_to_utf8 (filename));
+
   sgip = sgiOpen (filename, SGI_WRITE, compression, 1,
                   width, height, zsize);
   if (sgip == NULL)
@@ -584,9 +587,6 @@ save_image (const gchar  *filename,
       return FALSE;
     };
 
-  gimp_progress_init_printf (_("Saving '%s'"),
-                             gimp_filename_to_utf8 (filename));
-
   /*
    * Allocate memory for "tile_height" rows...
    */


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