diff --git a/ChangeLog b/ChangeLog index 2b2301de1f..8efec264f2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2005-09-29 Michael Natterer + + * tools/pdbgen/pdb/progress.pdb: removed the "wrap" from + gimp_progress_set_text() so it shows up as libgimp function again. + + * libgimp/gimpprogress_pdb.[ch]: regenerated. + + * libgimp/gimpprogress.[ch]: changed the old + gimp_progress_set_text() to gimp_progress_set_text_printf() and + added gimp_progress_init_printf(). (did this because the method of + calling init(NULL) followed by set_text("foo") caused popup + progress windows to be resized after they were shown). + + * libgimp/gimp.def: changed accordingly. + + * plug-ins/*/*.c: use gimp_progress_init_printf() instead of + init(NULL) plus set_text(foo) and changed users of set_text() to + use set_text_printf(). + 2005-09-29 Sven Neumann * plug-ins/script-fu/script-fu-interface.c: removed the frame diff --git a/libgimp/gimp.def b/libgimp/gimp.def index f9043bbe05..cdf59a13e4 100644 --- a/libgimp/gimp.def +++ b/libgimp/gimp.def @@ -504,10 +504,12 @@ EXPORTS gimp_procedural_db_temp_name gimp_progress_cancel gimp_progress_init + gimp_progress_init_printf gimp_progress_install gimp_progress_install_vtable gimp_progress_pulse gimp_progress_set_text + gimp_progress_set_text_printf gimp_progress_get_window_handle gimp_progress_uninstall gimp_progress_update diff --git a/libgimp/gimpprogress.c b/libgimp/gimpprogress.c index bcb9a63b75..2fd2cc8667 100644 --- a/libgimp/gimpprogress.c +++ b/libgimp/gimpprogress.c @@ -215,7 +215,42 @@ gimp_progress_uninstall (const gchar *progress_callback) } /** - * gimp_progress_set_text: + * gimp_progress_init_printf: + * @format: a standard printf() format string + * @Varargs: arguments for @format + * + * Initializes the progress bar for the current plug-in. + * + * Initializes the progress bar for the current plug-in. It is only + * valid to call this procedure from a plug-in. + * + * Returns: %TRUE on success. + * + * Since: GIMP 2.4 + **/ +gboolean +gimp_progress_init_printf (const gchar *format, + ...) +{ + gchar *text; + gboolean retval; + va_list args; + + g_return_val_if_fail (format != NULL, FALSE); + + va_start (args, format); + text = g_strdup_vprintf (format, args); + va_end (args); + + retval = gimp_progress_init (text); + + g_free (text); + + return retval; +} + +/** + * gimp_progress_set_text_printf: * @format: a standard printf() format string * @Varargs: arguments for @format * @@ -230,8 +265,8 @@ gimp_progress_uninstall (const gchar *progress_callback) * Since: GIMP 2.4 **/ gboolean -gimp_progress_set_text (const gchar *format, - ...) +gimp_progress_set_text_printf (const gchar *format, + ...) { gchar *text; gboolean retval; @@ -243,7 +278,7 @@ gimp_progress_set_text (const gchar *format, text = g_strdup_vprintf (format, args); va_end (args); - retval = _gimp_progress_set_text (text); + retval = gimp_progress_set_text (text); g_free (text); diff --git a/libgimp/gimpprogress.h b/libgimp/gimpprogress.h index 94ed89c40f..c5b3c3890d 100644 --- a/libgimp/gimpprogress.h +++ b/libgimp/gimpprogress.h @@ -53,12 +53,14 @@ struct _GimpProgressVtable }; -const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable, - gpointer user_data); -gpointer gimp_progress_uninstall (const gchar *progress_callback); +const gchar * gimp_progress_install_vtable (const GimpProgressVtable *vtable, + gpointer user_data); +gpointer gimp_progress_uninstall (const gchar *progress_callback); -gboolean gimp_progress_set_text (const gchar *format, - ...) G_GNUC_PRINTF (1, 2); +gboolean gimp_progress_init_printf (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); +gboolean gimp_progress_set_text_printf (const gchar *format, + ...) G_GNUC_PRINTF (1, 2); #ifndef GIMP_DISABLE_DEPRECATED diff --git a/libgimp/gimpprogress_pdb.c b/libgimp/gimpprogress_pdb.c index 9b363ef2e3..9a252721ee 100644 --- a/libgimp/gimpprogress_pdb.c +++ b/libgimp/gimpprogress_pdb.c @@ -121,7 +121,7 @@ gimp_progress_pulse (void) } /** - * _gimp_progress_set_text: + * gimp_progress_set_text: * @message: Message to use in the progress dialog. * * Changes the text in the progress bar for the current plug-in. @@ -135,7 +135,7 @@ gimp_progress_pulse (void) * Since: GIMP 2.4 */ gboolean -_gimp_progress_set_text (const gchar *message) +gimp_progress_set_text (const gchar *message) { GimpParam *return_vals; gint nreturn_vals; diff --git a/libgimp/gimpprogress_pdb.h b/libgimp/gimpprogress_pdb.h index 76d2a9b23f..f6d954662a 100644 --- a/libgimp/gimpprogress_pdb.h +++ b/libgimp/gimpprogress_pdb.h @@ -32,7 +32,7 @@ G_BEGIN_DECLS gboolean gimp_progress_init (const gchar *message); gboolean gimp_progress_update (gdouble percentage); gboolean gimp_progress_pulse (void); -gboolean _gimp_progress_set_text (const gchar *message); +gboolean gimp_progress_set_text (const gchar *message); gint gimp_progress_get_window_handle (void); gboolean _gimp_progress_install (const gchar *progress_callback); gboolean _gimp_progress_uninstall (const gchar *progress_callback); diff --git a/plug-ins/bmp/bmpread.c b/plug-ins/bmp/bmpread.c index 33965b466a..0811f7a63c 100644 --- a/plug-ins/bmp/bmpread.c +++ b/plug-ins/bmp/bmpread.c @@ -154,9 +154,8 @@ ReadBMP (const gchar *name) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (name)); + 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 */ diff --git a/plug-ins/bmp/bmpwrite.c b/plug-ins/bmp/bmpwrite.c index 40e848c715..395e7344ea 100644 --- a/plug-ins/bmp/bmpwrite.c +++ b/plug-ins/bmp/bmpwrite.c @@ -111,7 +111,6 @@ WriteBMP (const gchar *filename, gint rows, cols, Spcols, channels, MapSize, SpZeile; glong BitsPerPixel; gint colors; - gchar *temp_buf; guchar *pixels; GimpPixelRgn pixel_rgn; GimpDrawable *drawable; @@ -209,10 +208,8 @@ WriteBMP (const gchar *filename, 0, 0, drawable->width, drawable->height); /* And let's begin the progress */ - temp_buf = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (temp_buf); - g_free (temp_buf); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); cur_progress = 0; max_progress = drawable->height; diff --git a/plug-ins/common/gbr.c b/plug-ins/common/gbr.c index 897980a9a8..53309a334d 100644 --- a/plug-ins/common/gbr.c +++ b/plug-ins/common/gbr.c @@ -350,9 +350,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (read (fd, &bh, sizeof (BrushHeader)) != sizeof (BrushHeader)) { @@ -607,9 +606,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); drawable = gimp_drawable_get (drawable_ID); diff --git a/plug-ins/common/gif.c b/plug-ins/common/gif.c index 6b4fbc0d3a..9ba7946e70 100644 --- a/plug-ins/common/gif.c +++ b/plug-ins/common/gif.c @@ -869,7 +869,6 @@ save_image (const gchar *filename, guint rows, cols; gint BitsPerPixel, liberalBPP=0, useBPP=0; gint colors; - gchar *temp_buf; gint i; gint transparent; gint offset_x, offset_y; @@ -1005,10 +1004,8 @@ save_image (const gchar *filename, /* init the progress meter */ - temp_buf = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (temp_buf); - g_free (temp_buf); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* write the GIFheader */ diff --git a/plug-ins/common/gifload.c b/plug-ins/common/gifload.c index a00f293e82..675f51071c 100644 --- a/plug-ins/common/gifload.c +++ b/plug-ins/common/gifload.c @@ -280,17 +280,16 @@ static gint32 ReadImage (FILE *, const gchar *, static gint32 load_image (const gchar *filename) { - FILE *fd; - char * name_buf; - unsigned char buf[16]; - unsigned char c; - CMap localColorMap; - int grayScale; - int useGlobalColormap; - int bitPixel; - int imageCount = 0; - char version[4]; - gint32 image_ID = -1; + FILE *fd; + guchar buf[16]; + guchar c; + CMap localColorMap; + gint grayScale; + gint useGlobalColormap; + gint bitPixel; + gint imageCount = 0; + gchar version[4]; + gint32 image_ID = -1; fd = g_fopen (filename, "rb"); if (!fd) @@ -300,10 +299,8 @@ load_image (const gchar *filename) return -1; } - name_buf = g_strdup_printf (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (name_buf); - g_free (name_buf); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (!ReadOK (fd, buf, 6)) { diff --git a/plug-ins/common/gih.c b/plug-ins/common/gih.c index 453effbe53..adb945e194 100644 --- a/plug-ins/common/gih.c +++ b/plug-ins/common/gih.c @@ -651,9 +651,8 @@ gih_load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* The file format starts with a painfully simple text header */ @@ -1238,7 +1237,7 @@ gih_save_image (const gchar *filename, GimpPixelRgn pixel_rgn; GimpParasite *pipe_parasite; gchar *header; - gchar *msg, *parstring; + gchar *parstring; gint32 *layer_ID; gint fd; gint nlayers, layer, row, col; @@ -1261,10 +1260,8 @@ gih_save_image (const gchar *filename, return FALSE; } - msg = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (msg); - g_free (msg); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); parstring = gimp_pixpipe_params_build (&gihparams); diff --git a/plug-ins/common/gtm.c b/plug-ins/common/gtm.c index e4f7a03c44..4ebab42cd0 100644 --- a/plug-ins/common/gtm.c +++ b/plug-ins/common/gtm.c @@ -242,9 +242,8 @@ save_image (const gchar *filename, fprintf (fp, "%s\n", gtmvals.captiontxt); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width, drawable->height, diff --git a/plug-ins/common/iwarp.c b/plug-ins/common/iwarp.c index 352aafd1ad..8d00fc1fce 100644 --- a/plug-ins/common/iwarp.c +++ b/plug-ins/common/iwarp.c @@ -788,8 +788,8 @@ iwarp (void) destdrawable = gimp_drawable_get (animlayers[i]); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Warping Frame No. %d..."), frame_number); + gimp_progress_init_printf (_("Warping Frame No. %d..."), + frame_number); if (animate_deform_value > 0.0) iwarp_frame (); diff --git a/plug-ins/common/pat.c b/plug-ins/common/pat.c index 62cd2dfa62..735930c4da 100644 --- a/plug-ins/common/pat.c +++ b/plug-ins/common/pat.c @@ -323,9 +323,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (read (fd, &ph, sizeof (PatternHeader)) != sizeof (PatternHeader)) { @@ -454,9 +453,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); drawable = gimp_drawable_get (drawable_ID); gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width, diff --git a/plug-ins/common/pcx.c b/plug-ins/common/pcx.c index 16ef170e1f..e8609abf8f 100644 --- a/plug-ins/common/pcx.c +++ b/plug-ins/common/pcx.c @@ -311,9 +311,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (fread (&pcx_header, 128, 1, fd) == 0) { @@ -548,9 +547,8 @@ save_image (const gchar *filename, height = drawable->height; gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); pcx_header.manufacturer = 0x0a; pcx_header.version = 5; diff --git a/plug-ins/common/pix.c b/plug-ins/common/pix.c index 866d96145e..4a0cf2699f 100644 --- a/plug-ins/common/pix.c +++ b/plug-ins/common/pix.c @@ -331,9 +331,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* Read header information */ width = get_short (file); @@ -511,9 +510,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* Write the image header */ PIX_DEBUG_PRINT ("Width %hu\n", drawable->width); diff --git a/plug-ins/common/png.c b/plug-ins/common/png.c index a1e453526b..aecd11149d 100644 --- a/plug-ins/common/png.c +++ b/plug-ins/common/png.c @@ -724,9 +724,8 @@ load_image (const gchar *filename, png_init_io (pp, fp); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* * Get the image dimensions and create the image... @@ -1226,9 +1225,8 @@ save_image (const gchar *filename, png_init_io (pp, fp); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* * Get the drawable for the current image... diff --git a/plug-ins/common/pnm.c b/plug-ins/common/pnm.c index fef6ebf8f3..62330ed45f 100644 --- a/plug-ins/common/pnm.c +++ b/plug-ins/common/pnm.c @@ -444,9 +444,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* allocate the necessary structures */ pnminfo = g_new (PNMInfo, 1); @@ -792,7 +791,6 @@ save_image (const gchar *filename, unsigned char *data, *d; char *rowbuf; char buf[BUFLEN]; - char *temp; int np = 0; int xres, yres; int ypos, yend; @@ -821,10 +819,8 @@ save_image (const gchar *filename, return FALSE; } - temp = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (temp); - g_free (temp); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); xres = drawable->width; yres = drawable->height; diff --git a/plug-ins/common/poppler.c b/plug-ins/common/poppler.c index 5cadf393c5..a6abe75cae 100644 --- a/plug-ins/common/poppler.c +++ b/plug-ins/common/poppler.c @@ -460,9 +460,8 @@ load_image (PopplerDocument *doc, if (target == GIMP_PAGE_SELECTOR_TARGET_IMAGES) images = g_new0 (gint32, pages->n_pages); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); scale = resolution / gimp_unit_get_factor (GIMP_UNIT_POINT); diff --git a/plug-ins/common/postscript.c b/plug-ins/common/postscript.c index 0d0960b9d5..397725cbd1 100644 --- a/plug-ins/common/postscript.c +++ b/plug-ins/common/postscript.c @@ -1014,9 +1014,8 @@ load_image (const gchar *filename) } fclose (ifp); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf, &ChildPid); @@ -1187,9 +1186,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); save_ps_header (ofp, filename); diff --git a/plug-ins/common/psd.c b/plug-ins/common/psd.c index 45fa31d9ac..897b9cd0a3 100644 --- a/plug-ins/common/psd.c +++ b/plug-ins/common/psd.c @@ -1882,9 +1882,8 @@ load_image (const gchar *name) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (name)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (name)); read_whole_file (fd); diff --git a/plug-ins/common/psd_save.c b/plug-ins/common/psd_save.c index e9cabdeb05..84f6017ea4 100644 --- a/plug-ins/common/psd_save.c +++ b/plug-ins/common/psd_save.c @@ -1351,9 +1351,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); IFDBG g_print (" File \"%s\" has been opened\n", gimp_filename_to_utf8 (filename)); diff --git a/plug-ins/common/randomize.c b/plug-ins/common/randomize.c index bb681b530d..8ee3c35561 100644 --- a/plug-ins/common/randomize.c +++ b/plug-ins/common/randomize.c @@ -386,10 +386,9 @@ run (const gchar *name, case RNDM_SLUR: rndm_type_str = "slur"; break; } - gimp_progress_init (NULL); - gimp_progress_set_text ("%s (%s)...", - gettext (RNDM_VERSION[rndm_type - 1]), - gettext (rndm_type_str)); + gimp_progress_init_printf ("%s (%s)...", + gettext (RNDM_VERSION[rndm_type - 1]), + gettext (rndm_type_str)); gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1)); /* diff --git a/plug-ins/common/raw.c b/plug-ins/common/raw.c index 94a9dddf5a..aa9c522d9b 100644 --- a/plug-ins/common/raw.c +++ b/plug-ins/common/raw.c @@ -649,9 +649,8 @@ load_image (gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); size = get_file_info (filename); diff --git a/plug-ins/common/sunras.c b/plug-ins/common/sunras.c index 084a2369e3..94a5ca9705 100644 --- a/plug-ins/common/sunras.c +++ b/plug-ins/common/sunras.c @@ -430,9 +430,8 @@ load_image (const gchar *filename) *4 + sunhdr.l_ras_maplength, SEEK_SET); } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); switch (sunhdr.l_ras_depth) { @@ -510,9 +509,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + 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, 0, (int)psvals.rle); diff --git a/plug-ins/common/tga.c b/plug-ins/common/tga.c index a32bf230ef..d0d20def71 100644 --- a/plug-ins/common/tga.c +++ b/plug-ins/common/tga.c @@ -416,9 +416,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (!fseek (fp, -26L, SEEK_END)) { /* Is file big enough for a footer? */ if (fread (footer, sizeof (footer), 1, fp) != 1) @@ -1029,9 +1028,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); header[0] = 0; /* No image identifier / description */ diff --git a/plug-ins/common/tiff.c b/plug-ins/common/tiff.c index 2e2420dc9b..3b91dce79a 100644 --- a/plug-ins/common/tiff.c +++ b/plug-ins/common/tiff.c @@ -532,9 +532,8 @@ load_image (const gchar *filename) gimp_quit (); } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* We will loop through the all pages in case of multipage TIFF and load every page as a separate layer. */ @@ -1923,9 +1922,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); drawable = gimp_drawable_get (layer); drawable_type = gimp_drawable_type (layer); diff --git a/plug-ins/common/wmf.c b/plug-ins/common/wmf.c index dc5eb1e9a5..5320b58802 100644 --- a/plug-ins/common/wmf.c +++ b/plug-ins/common/wmf.c @@ -949,9 +949,8 @@ load_image (const gchar *filename) gimp_quit (); } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + 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); diff --git a/plug-ins/common/xbm.c b/plug-ins/common/xbm.c index 85452ee3b6..1e939b6cfe 100644 --- a/plug-ins/common/xbm.c +++ b/plug-ins/common/xbm.c @@ -722,9 +722,8 @@ load_image (const gchar *filename) return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); comment = fgetcomment (fp); @@ -947,7 +946,7 @@ save_image (const gchar *filename, gint bpp; guchar *data, *cmap; - gchar *name_buf, *intfmt; + gchar *intfmt; #if 0 if (save_mask) @@ -1005,10 +1004,8 @@ save_image (const gchar *filename, return FALSE; } - name_buf = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (name_buf); - g_free (name_buf); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* Maybe write the image comment. */ #if 0 diff --git a/plug-ins/common/xpm.c b/plug-ins/common/xpm.c index 452d8b110d..3ecabce60e 100644 --- a/plug-ins/common/xpm.c +++ b/plug-ins/common/xpm.c @@ -340,9 +340,8 @@ load_image (const gchar *filename) guchar *cmap; gint32 image_ID; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* read the raw file */ switch (XpmReadFileToXpmImage ((char *) filename, &xpm_image, NULL)) @@ -621,9 +620,8 @@ save_image (const gchar *filename, hash = g_hash_table_new ((GHashFunc) rgbhash, (GCompareFunc) compare); - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); ncolors = alpha ? 1 : 0; diff --git a/plug-ins/common/xwd.c b/plug-ins/common/xwd.c index 3335c6ddf7..bfa3fed240 100644 --- a/plug-ins/common/xwd.c +++ b/plug-ins/common/xwd.c @@ -470,9 +470,8 @@ load_image (const gchar *filename) } } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); depth = xwdhdr.l_pixmap_depth; bpp = xwdhdr.l_bits_per_pixel; @@ -537,7 +536,6 @@ save_image (const gchar *filename, FILE *ofp; GimpImageType drawable_type; gint retval; - gchar *temp; drawable_type = gimp_drawable_type (drawable_ID); @@ -569,10 +567,8 @@ save_image (const gchar *filename, return FALSE; } - temp = g_strdup_printf (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - gimp_progress_init (temp); - g_free (temp); + 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, 0); diff --git a/plug-ins/faxg3/faxg3.c b/plug-ins/faxg3/faxg3.c index fb2b024ccd..c50db81f42 100644 --- a/plug-ins/faxg3/faxg3.c +++ b/plug-ins/faxg3/faxg3.c @@ -201,9 +201,8 @@ load_image (const gchar *filename) gint max_rows; /* max. rows allocated */ gint col, hcol; /* column, highest column ever used */ - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* initialize lookup trees */ build_tree( &white, t_white ); diff --git a/plug-ins/fits/fits.c b/plug-ins/fits/fits.c index 66467388d7..99fef6d07f 100644 --- a/plug-ins/fits/fits.c +++ b/plug-ins/fits/fits.c @@ -456,9 +456,8 @@ save_image (const gchar *filename, return (FALSE); } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); if ((drawable_type == GIMP_INDEXED_IMAGE) || (drawable_type == GIMP_INDEXEDA_IMAGE)) diff --git a/plug-ins/gfli/gfli.c b/plug-ins/gfli/gfli.c index d0c1a80d97..1822c59ee0 100644 --- a/plug-ins/gfli/gfli.c +++ b/plug-ins/gfli/gfli.c @@ -465,9 +465,8 @@ load_image (const gchar *filename, return -1; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); fli_read_header (file, &fli_header); if (fli_header.magic == NO_HEADER) @@ -681,9 +680,8 @@ save_image (const gchar *filename, return FALSE; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* * First build the fli header. diff --git a/plug-ins/ifscompose/ifscompose.c b/plug-ins/ifscompose/ifscompose.c index 4daff22eda..b5956c9e0e 100644 --- a/plug-ins/ifscompose/ifscompose.c +++ b/plug-ins/ifscompose/ifscompose.c @@ -1296,8 +1296,6 @@ ifs_compose (GimpDrawable *drawable) gimp_context_get_background (&color); gimp_rgb_get_uchar (&color, &rc, &gc, &bc); - gimp_progress_init (NULL); - for (band_no = 0, band_y = 0; band_no < num_bands; band_no++) { GimpPixelRgn dest_rgn; @@ -1305,9 +1303,8 @@ ifs_compose (GimpDrawable *drawable) gint progress; gint max_progress; - gimp_progress_update (0.0); - gimp_progress_set_text (_("Rendering IFS (%d/%d)..."), - band_no + 1, num_bands); + gimp_progress_init_printf (_("Rendering IFS (%d/%d)..."), + band_no + 1, num_bands); /* render the band to a buffer */ if (band_y + band_height > height) @@ -1323,9 +1320,8 @@ ifs_compose (GimpDrawable *drawable) /* transfer the image to the drawable */ - gimp_progress_update (0.0); - gimp_progress_set_text (_("Copying IFS to image (%d/%d)..."), - band_no + 1, num_bands); + gimp_progress_init_printf (_("Copying IFS to image (%d/%d)..."), + band_no + 1, num_bands); progress = 0; max_progress = band_height * width; diff --git a/plug-ins/jpeg/jpeg-load.c b/plug-ins/jpeg/jpeg-load.c index 96842a3bb4..c0789de2e5 100644 --- a/plug-ins/jpeg/jpeg-load.c +++ b/plug-ins/jpeg/jpeg-load.c @@ -88,11 +88,8 @@ load_image (const gchar *filename, } if (!preview) - { - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); - } + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); image_ID = -1; @@ -606,9 +603,8 @@ load_thumbnail_image (const gchar *filename, jerr.pub.emit_message = my_emit_message; jerr.pub.output_message = my_output_message; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening thumbnail for '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening thumbnail for '%s'..."), + gimp_filename_to_utf8 (filename)); /* Establish the setjmp return context for my_error_exit to use. */ if (setjmp (jerr.setjmp_buffer)) diff --git a/plug-ins/jpeg/jpeg-save.c b/plug-ins/jpeg/jpeg-save.c index 6337cbca79..684d8de8a2 100644 --- a/plug-ins/jpeg/jpeg-save.c +++ b/plug-ins/jpeg/jpeg-save.c @@ -220,11 +220,8 @@ save_image (const gchar *filename, 0, 0, drawable->width, drawable->height, FALSE, FALSE); if (!preview) - { - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); - } + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* Step 1: allocate and initialize JPEG compression object */ diff --git a/plug-ins/sgi/sgi.c b/plug-ins/sgi/sgi.c index 886abcd410..2c08d3844a 100644 --- a/plug-ins/sgi/sgi.c +++ b/plug-ins/sgi/sgi.c @@ -315,9 +315,8 @@ load_image (const gchar *filename) /* I - File to load */ return -1; }; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* * Get the image dimensions and create the image... @@ -535,9 +534,8 @@ save_image (const gchar *filename, return FALSE; }; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* * Allocate memory for "tile_height" rows... diff --git a/plug-ins/uri/uri-backend-gnomevfs.c b/plug-ins/uri/uri-backend-gnomevfs.c index 027e3568a0..3a63652ca7 100644 --- a/plug-ins/uri/uri-backend-gnomevfs.c +++ b/plug-ins/uri/uri-backend-gnomevfs.c @@ -228,10 +228,9 @@ copy_uri (const gchar *src_uri, memsize = gimp_memsize_to_string (file_size); - gimp_progress_init (NULL); - gimp_progress_set_text (file_size > 0 ? - copying_format_str : copied_format_str, - memsize); + gimp_progress_init_printf (file_size > 0 ? + copying_format_str : copied_format_str, + memsize); g_free (memsize); diff --git a/plug-ins/uri/uri-backend-wget.c b/plug-ins/uri/uri-backend-wget.c index 5055b8a0f9..933897aa21 100644 --- a/plug-ins/uri/uri-backend-wget.c +++ b/plug-ins/uri/uri-backend-wget.c @@ -166,9 +166,8 @@ uri_backend_load_image (const gchar *uri, timeout_msg = g_strdup_printf (_("(timeout is %s seconds)"), TIMEOUT); - gimp_progress_init (NULL); - gimp_progress_set_text ("%s %s", - _("Connecting to server..."), timeout_msg); + gimp_progress_init_printf ("%s %s", + _("Connecting to server..."), timeout_msg); read_connect: if (fgets (buf, sizeof (buf), input) == NULL) diff --git a/plug-ins/winicon/icoload.c b/plug-ins/winicon/icoload.c index d54db66032..0e42087b38 100644 --- a/plug-ins/winicon/icoload.c +++ b/plug-ins/winicon/icoload.c @@ -457,9 +457,8 @@ ico_load_image (const gchar *filename) gint height = 0; gint i; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); if (! ico_init (filename, &ico)) return -1; @@ -522,9 +521,8 @@ ico_load_thumbnail_image (const gchar *filename, gint match = 0; gint i; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening thumbnail for '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening thumbnail for '%s'..."), + gimp_filename_to_utf8 (filename)); if (! ico_init (filename, &ico)) return -1; diff --git a/plug-ins/winicon/icosave.c b/plug-ins/winicon/icosave.c index 65468fcc34..6ee9f1ba81 100644 --- a/plug-ins/winicon/icosave.c +++ b/plug-ins/winicon/icosave.c @@ -974,9 +974,8 @@ SaveICO (const gchar *filename, if ((icon_depths = ico_show_icon_dialog (image, &num_icons)) == NULL) return GIMP_PDB_CANCEL; - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* Okay, let's actually save the thing with the depths the user specified. */ diff --git a/plug-ins/xjt/xjt.c b/plug-ins/xjt/xjt.c index cb17044380..1fa344fa5a 100644 --- a/plug-ins/xjt/xjt.c +++ b/plug-ins/xjt/xjt.c @@ -1686,9 +1686,8 @@ save_xjt_image (const gchar *filename, break; } - gimp_progress_init (NULL); - gimp_progress_set_text (_("Saving '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Saving '%s'..."), + gimp_filename_to_utf8 (filename)); /* create temporary directory */ l_dirname = gimp_temp_name (".tmpdir"); @@ -3312,9 +3311,8 @@ load_xjt_image (const gchar *filename) l_fsel_attached_to_id = -1; /* -1 assume fsel is not available (and not attached to any drawable) */ l_fsel_id = -1; /* -1 assume there is no floating selection */ - gimp_progress_init (NULL); - gimp_progress_set_text (_("Opening '%s'..."), - gimp_filename_to_utf8 (filename)); + gimp_progress_init_printf (_("Opening '%s'..."), + gimp_filename_to_utf8 (filename)); /* create temporary directory */ l_dirname = gimp_temp_name (".tmpdir"); diff --git a/tools/pdbgen/pdb/progress.pdb b/tools/pdbgen/pdb/progress.pdb index ddfc2ad850..dd027a7f01 100644 --- a/tools/pdbgen/pdb/progress.pdb +++ b/tools/pdbgen/pdb/progress.pdb @@ -136,8 +136,7 @@ HELP @inargs = ( { name => 'message', type => 'string', null_ok => 1, - desc => 'Message to use in the progress dialog', - wrap => 1 } + desc => 'Message to use in the progress dialog' } ); %invoke = ( code => <<'CODE'