accept an empty string.

2005-02-13  Sven Neumann  <sven@gimp.org>

	* app/core/gimpprogress.c (gimp_progress_start): accept an empty
	string.

	* app/plug-in/plug-in-progress.c: if NULL is passed as message to
	plug_in_progress_start(), set an empty string on the progress.

	* tools/pdbgen/pdb/progress.pdb:
	* libgimp/gimpprogress.[ch]: wrap the new gimp_progress_set_text()
	PDP function with a function that accepts printf-like arguments.

	* libgimp/gimpprogress_pdb.[ch]: regenerated.

	* lots of plug-ins, most of them file plug-ins:
	use gimp_progress_init(NULL) followed by gimp_progress_set_text()
	to initialize the progress using the new API instead of constructing
	a temporary string.
This commit is contained in:
Sven Neumann 2005-02-13 00:11:24 +00:00 committed by Sven Neumann
parent 08bd204c0e
commit 4cf9d0e429
43 changed files with 229 additions and 278 deletions

View file

@ -1,3 +1,22 @@
2005-02-13 Sven Neumann <sven@gimp.org>
* app/core/gimpprogress.c (gimp_progress_start): accept an empty
string.
* app/plug-in/plug-in-progress.c: if NULL is passed as message to
plug_in_progress_start(), set an empty string on the progress.
* tools/pdbgen/pdb/progress.pdb:
* libgimp/gimpprogress.[ch]: wrap the new gimp_progress_set_text()
PDP function with a function that accepts printf-like arguments.
* libgimp/gimpprogress_pdb.[ch]: regenerated.
* lots of plug-ins, most of them file plug-ins:
use gimp_progress_init(NULL) followed by gimp_progress_set_text()
to initialize the progress using the new API instead of constructing
a temporary string.
2005-02-12 Michael Natterer <mitch@gimp.org>
* app/dialogs/file-save-dialog.c (file_save_dialog_response): use

View file

@ -103,7 +103,7 @@ gimp_progress_start (GimpProgress *progress,
g_return_val_if_fail (GIMP_IS_PROGRESS (progress), NULL);
if (! message || ! strlen (message))
if (! message)
message = _("Please wait...");
progress_iface = GIMP_PROGRESS_GET_INTERFACE (progress);

View file

@ -53,9 +53,6 @@ plug_in_progress_start (PlugIn *plug_in,
proc_frame = plug_in_get_proc_frame (plug_in);
if (! message)
message = plug_in->prog;
if (! proc_frame->progress)
{
proc_frame->progress = gimp_new_progress (plug_in->gimp, display_ID);
@ -78,6 +75,7 @@ plug_in_progress_start (PlugIn *plug_in,
if (gimp_progress_is_active (proc_frame->progress))
{
if (message)
gimp_progress_set_text (proc_frame->progress, message);
if (gimp_progress_get_value (proc_frame->progress) > 0.0)
@ -85,7 +83,9 @@ plug_in_progress_start (PlugIn *plug_in,
}
else
{
gimp_progress_start (proc_frame->progress, message, TRUE);
gimp_progress_start (proc_frame->progress,
message ? message : "",
TRUE);
}
}
}

View file

@ -53,9 +53,6 @@ plug_in_progress_start (PlugIn *plug_in,
proc_frame = plug_in_get_proc_frame (plug_in);
if (! message)
message = plug_in->prog;
if (! proc_frame->progress)
{
proc_frame->progress = gimp_new_progress (plug_in->gimp, display_ID);
@ -78,6 +75,7 @@ plug_in_progress_start (PlugIn *plug_in,
if (gimp_progress_is_active (proc_frame->progress))
{
if (message)
gimp_progress_set_text (proc_frame->progress, message);
if (gimp_progress_get_value (proc_frame->progress) > 0.0)
@ -85,7 +83,9 @@ plug_in_progress_start (PlugIn *plug_in,
}
else
{
gimp_progress_start (proc_frame->progress, message, TRUE);
gimp_progress_start (proc_frame->progress,
message ? message : "",
TRUE);
}
}
}

View file

@ -81,7 +81,8 @@ Functions for embedding the progress bar into a plug-in's GUI.
</para>
@message:
@format:
@Varargs:
@Returns:

View file

@ -178,6 +178,42 @@ gimp_progress_uninstall (const gchar *progress_callback)
return user_data;
}
/**
* gimp_progress_set_text:
* @format: a standard printf() format string
* @Varargs: arguments for @format
*
* Changes the text in the progress bar for the current plug-in.
*
* This function allows to change the text in the progress bar for the
* current plug-in. Unlike gimp_progress_init() it does not change the
* displayed value.
*
* Returns: %TRUE on success.
*
* Since: GIMP 2.4
**/
void
gimp_progress_set_text (const gchar *format,
...)
{
gchar *text;
gboolean retval;
va_list args;
g_return_if_fail (format != NULL);
va_start (args, format);
text = g_strdup_vprintf (format, args);
va_end (args);
retval = _gimp_progress_set_text (text);
g_free (text);
return retval;
}
/* private functions */

View file

@ -42,6 +42,9 @@ const gchar * gimp_progress_install (GimpProgressStartCallback start_callback,
gpointer user_data);
gpointer gimp_progress_uninstall (const gchar *progress_callback);
void gimp_progress_set_text (const gchar *format,
...) G_GNUC_PRINTF (1, 2);
G_END_DECLS

View file

@ -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;

View file

@ -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);
gboolean _gimp_progress_install (const gchar *progress_callback);
gboolean _gimp_progress_uninstall (const gchar *progress_callback);
gboolean gimp_progress_cancel (const gchar *progress_callback);

View file

@ -136,7 +136,6 @@ gint32
ReadBMP (const gchar *name)
{
FILE *fd;
gchar *temp_buf;
guchar buffer[64];
gint ColormapSize, rowbytes, Maps;
gboolean Grey;
@ -155,10 +154,9 @@ ReadBMP (const gchar *name)
return -1;
}
temp_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
gimp_progress_init (temp_buf);
g_free (temp_buf);
/* It is a File. Now is it a Bitmap? Read the shortest possible header */

View file

@ -306,7 +306,6 @@ run (const gchar *name,
static gint32
load_image (const gchar *filename)
{
gchar *temp;
gchar *name;
gint fd;
BrushHeader bh;
@ -329,10 +328,9 @@ load_image (const gchar *filename)
return -1;
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
if (read (fd, &bh, sizeof (BrushHeader)) != sizeof (BrushHeader))
{
@ -385,7 +383,7 @@ load_image (const gchar *filename)
if ((bn_size = (bh.header_size - sizeof (BrushHeader))) > 0)
{
temp = g_new (gchar, bn_size);
gchar *temp = g_new (gchar, bn_size);
if ((read (fd, temp, bn_size)) < bn_size)
{
@ -570,7 +568,6 @@ save_image (const gchar *filename,
gint line;
gint x;
GimpPixelRgn pixel_rgn;
gchar *temp;
if (gimp_drawable_type (drawable_ID) != GIMP_GRAY_IMAGE &&
gimp_drawable_type (drawable_ID) != GIMP_RGBA_IMAGE)
@ -588,10 +585,9 @@ save_image (const gchar *filename,
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
drawable = gimp_drawable_get (drawable_ID);

View file

@ -630,7 +630,6 @@ gih_load_one_brush (gint fd,
static gint32
gih_load_image (const gchar *filename)
{
gchar *temp;
gint fd;
gint i;
gint32 image_ID;
@ -650,10 +649,9 @@ gih_load_image (const gchar *filename)
return -1;
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
/* The file format starts with a painfully simple text header */

View file

@ -213,7 +213,6 @@ save_image (const gchar *filename,
guchar *buffer, *buf2;
gchar *width, *height;
GimpPixelRgn pixel_rgn;
gchar *name;
FILE *fp;
palloc = g_new (int, drawable->width * drawable->height);
@ -242,10 +241,9 @@ save_image (const gchar *filename,
fprintf (fp, "<CAPTION>%s</CAPTION>\n",
gtmvals.captiontxt);
name = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
gimp_pixel_rgn_init (&pixel_rgn, drawable,
0, 0, drawable->width, drawable->height,

View file

@ -753,7 +753,6 @@ iwarp (void)
gint i;
gint32 layerID;
gint32 *animlayers;
gchar *st;
gdouble delta;
if (image_bpp == 1 || image_bpp == 3)
@ -780,7 +779,8 @@ iwarp (void)
frame_number = 0;
for (i = 0; i < animate_num_frames; i++)
{
st = g_strdup_printf (_("Frame %d"), i);
gchar *st = g_strdup_printf (_("Frame %d"), i);
animlayers[i] = gimp_layer_copy (layerID);
gimp_layer_add_alpha (animlayers[i]);
gimp_drawable_set_name (animlayers[i], st);
@ -790,9 +790,8 @@ iwarp (void)
destdrawable = gimp_drawable_get (animlayers[i]);
st = g_strdup_printf (_("Warping Frame No. %d..."), frame_number);
gimp_progress_init (st);
g_free (st);
gimp_progress_init (NULL);
gimp_progress_set_text (_("Warping Frame No. %d..."), frame_number);
if (animate_deform_value > 0.0)
iwarp_frame ();
@ -800,14 +799,15 @@ iwarp (void)
animate_deform_value = animate_deform_value + delta;
frame_number++;
}
if (do_animate_ping_pong)
{
st = g_strdup_printf (_("Warping Frame No. %d..."), frame_number);
gimp_progress_init (_("Ping pong"));
g_free (st);
for (i = 0; i < animate_num_frames; i++)
{
gchar *st;
gimp_progress_update ((gdouble) i / (animate_num_frames - 1));
layerID = gimp_layer_copy (animlayers[animate_num_frames-i-1]);

View file

@ -280,10 +280,10 @@ run (const gchar *name,
static gint32
load_image (const gchar *filename)
{
gchar *temp;
gint fd;
PatternHeader ph;
gchar *name;
gchar *temp;
guchar *buffer;
gint32 image_ID;
gint32 layer_ID;
@ -302,10 +302,9 @@ load_image (const gchar *filename)
return -1;
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
if (read (fd, &ph, sizeof (PatternHeader)) != sizeof (PatternHeader))
{
@ -424,7 +423,6 @@ save_image (const gchar *filename,
GimpDrawable *drawable;
gint line;
GimpPixelRgn pixel_rgn;
gchar *temp;
fd = open (filename, O_CREAT | O_TRUNC | O_WRONLY | _O_BINARY, 0644);
@ -435,10 +433,9 @@ save_image (const gchar *filename,
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
drawable = gimp_drawable_get (drawable_ID);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, drawable->width,

View file

@ -291,7 +291,6 @@ load_image (const gchar *filename)
FILE *fd;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
gchar *message;
gint offset_x, offset_y, height, width;
gint32 image, layer;
guchar *dest, cmap[768];
@ -304,10 +303,9 @@ load_image (const gchar *filename)
return -1;
}
message = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (message);
g_free (message);
if (fread (&pcx_header, 128, 1, fd) == 0)
{
@ -532,7 +530,6 @@ save_image (const gchar *filename,
GimpImageType drawable_type;
guchar *cmap= NULL, *pixels;
gint offset_x, offset_y, width, height;
gchar *message;
int colors, i;
drawable = gimp_drawable_get (layer);
@ -542,10 +539,9 @@ save_image (const gchar *filename,
height = drawable->height;
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0, width, height, FALSE, FALSE);
message = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (message);
g_free (message);
pcx_header.manufacturer = 0x0a;
pcx_header.version = 5;

View file

@ -311,7 +311,6 @@ load_image (const gchar *filename)
{
gint i, j, tile_height, row;
FILE *file = NULL;
gchar *progMessage = ident; /* only to suppress compiler warnings */
guchar *dest;
guchar *dest_base;
GimpDrawable *drawable;
@ -334,11 +333,9 @@ load_image (const gchar *filename)
return -1;
}
/* Set up progress display */
progMessage = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progMessage);
g_free (progMessage);
/* Read header information */
width = get_short (file);
@ -494,7 +491,6 @@ save_image (const gchar *filename,
gboolean savingColor = TRUE;
guchar *src;
guchar *src_base;
gchar *progMessage;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
FILE *file;
@ -517,11 +513,9 @@ save_image (const gchar *filename,
return FALSE;
}
/* Set up progress display */
progMessage = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progMessage);
g_free (progMessage);
/* Write the image header */
PIX_DEBUG_PRINT ("Width %hu\n", drawable->width);

View file

@ -630,7 +630,6 @@ load_image (const gchar *filename,
png_infop info; /* PNG info pointers */
guchar **pixels, /* Pixel rows */
*pixel; /* Pixel data */
gchar *progress; /* Title for progress display... */
guchar alpha[256], /* Index -> Alpha */
*alpha_ptr; /* Temporary pointer */
@ -678,10 +677,9 @@ load_image (const gchar *filename,
png_init_io (pp, fp);
progress = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progress);
g_free (progress);
/*
* Get the image dimensions and create the image...
@ -1092,7 +1090,6 @@ save_image (const gchar *filename,
guchar **pixels, /* Pixel rows */
*fixed, /* Fixed-up pixel data */
*pixel; /* Pixel data */
gchar *progress; /* Title for progress display... */
gdouble xres, yres; /* GIMP resolution (dpi) */
png_color_16 background; /* Background color */
png_time mod_time; /* Modification time (ie NOW) */
@ -1182,10 +1179,9 @@ save_image (const gchar *filename,
png_init_io (pp, fp);
progress = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progress);
g_free (progress);
/*
* Get the drawable for the current image...

View file

@ -418,7 +418,6 @@ load_image (const gchar *filename)
gint32 layer_ID;
GimpDrawable *drawable;
int fd; /* File descriptor */
char *temp;
char buf[BUFLEN]; /* buffer for random things like scanning */
PNMInfo *pnminfo;
PNMScanner * volatile scan;
@ -434,10 +433,9 @@ load_image (const gchar *filename)
return -1;
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
/* allocate the necessary structures */
pnminfo = g_new (PNMInfo, 1);

View file

@ -993,10 +993,9 @@ load_image (const gchar *filename)
}
fclose (ifp);
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
ifp = ps_open (filename, &plvals, &llx, &lly, &urx, &ury, &is_epsf,
&ChildPid);
@ -1089,7 +1088,6 @@ save_image (const gchar *filename,
FILE* ofp;
GimpImageType drawable_type;
gint retval;
char *temp = ident; /* Just to satisfy lint/gcc */
/* initialize */
@ -1125,10 +1123,9 @@ save_image (const gchar *filename,
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
save_ps_header (ofp, filename);

View file

@ -1736,7 +1736,6 @@ load_image (const gchar *name)
{
FILE *fd;
gboolean want_aux;
char *name_buf;
guchar *cmykbuf;
guchar *dest = NULL, *temp;
long channels, nguchars;
@ -1761,10 +1760,9 @@ load_image (const gchar *name)
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (name));
gimp_progress_init (name_buf);
g_free (name_buf);
read_whole_file (fd);

View file

@ -1574,10 +1574,9 @@ save_image (const gchar *filename,
gint32 image_id)
{
FILE *fd;
gchar *name_buf;
gint32 *layers;
int nlayers;
int i;
gint nlayers;
gint i;
GimpDrawable *drawable;
IFDBG printf (" Function: save_image\n");
@ -1614,10 +1613,9 @@ save_image (const gchar *filename,
return FALSE;
}
name_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
IFDBG g_print (" File \"%s\" has been opened\n",
gimp_filename_to_utf8 (filename));

View file

@ -296,7 +296,6 @@ run (const gchar *name,
GimpRunMode run_mode;
GimpPDBStatusType status = GIMP_PDB_SUCCESS; /* assume the best! */
gchar *rndm_type_str = "";
gchar prog_label[32];
static GimpParam values[1];
GRand *gr; /* The GRand object which generates the
* random numbers */
@ -400,11 +399,12 @@ run (const gchar *name,
case RNDM_SLUR: rndm_type_str = "slur"; break;
}
sprintf (prog_label, "%s (%s)...",
gimp_progress_init (NULL);
gimp_progress_set_text ("%s (%s)...",
gettext (RNDM_VERSION[rndm_type - 1]),
gettext (rndm_type_str));
gimp_progress_init (prog_label);
gimp_tile_cache_ntiles (2 * (drawable->width / gimp_tile_width () + 1));
gimp_tile_cache_ntiles (2 *
(drawable->width / gimp_tile_width () + 1));
/*
* Initialize the g_rand() function seed
*/

View file

@ -625,7 +625,6 @@ load_image (gchar *filename)
GimpImageBaseType itype = GIMP_RGB_IMAGE;
gint32 size;
gint bpp = 0;
gchar *name_buf;
data = g_new0 (RawGimpData, 1);
@ -637,10 +636,9 @@ load_image (gchar *filename)
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
size = get_file_info (filename);

View file

@ -372,7 +372,6 @@ load_image (const gchar *filename)
{
gint32 image_ID;
FILE *ifp;
char *temp = ident; /* Just to satisfy gcc/lint */
L_SUNFILEHEADER sunhdr;
guchar *suncolmap = NULL;
@ -433,10 +432,9 @@ load_image (const gchar *filename)
*4 + sunhdr.l_ras_maplength, SEEK_SET);
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
switch (sunhdr.l_ras_depth)
{
@ -483,7 +481,6 @@ save_image (const gchar *filename,
FILE* ofp;
GimpImageType drawable_type;
gint retval;
char *temp;
drawable_type = gimp_drawable_type (drawable_ID);
@ -515,10 +512,9 @@ save_image (const gchar *filename,
return FALSE;
}
temp = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
if (drawable_type == GIMP_INDEXED_IMAGE)
retval = save_index (ofp,image_ID, drawable_ID, 0, (int)psvals.rle);

View file

@ -400,7 +400,6 @@ static gint32
load_image (const gchar *filename)
{
FILE *fp;
gchar *name_buf;
tga_info info;
guchar header[18];
guchar footer[26];
@ -417,10 +416,9 @@ load_image (const gchar *filename)
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
if (!fseek (fp, -26L, SEEK_END)) { /* Is file big enough for a footer? */
if (fread (footer, sizeof (footer), 1, fp) != 1)
@ -1005,7 +1003,6 @@ save_image (const gchar *filename,
gint height;
FILE *fp;
gchar *name_buf;
gint tileheight;
gint out_bpp = 0;
gboolean status = TRUE;
@ -1032,10 +1029,9 @@ save_image (const gchar *filename,
return FALSE;
}
name_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
header[0] = 0; /* No image identifier / description */

View file

@ -500,7 +500,6 @@ load_image (const gchar *filename)
gint i, j;
gint ilayer;
gboolean worst_case = FALSE;
gchar *name;
TiffSaveVals save_vals;
GimpParasite *parasite;
@ -516,6 +515,7 @@ load_image (const gchar *filename)
gboolean uselayername = FALSE;
guchar *tmp_name;
gchar *name;
gimp_rgb_set (&color, 0.0, 0.0, 0.0);
@ -531,10 +531,9 @@ load_image (const gchar *filename)
gimp_quit ();
}
name = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
/* We will loop through the all pages in case of multipage TIFF
and load every page as a separate layer. */
@ -1892,7 +1891,6 @@ save_image (const gchar *filename,
GimpPixelRgn pixel_rgn;
gint tile_height;
gint y, yend;
gchar *name;
gboolean is_bw = FALSE, invert = TRUE;
guchar bw_map[] = { 0, 0, 0, 255, 255, 255 };
guchar wb_map[] = { 255, 255, 255, 0, 0, 0 };
@ -1921,10 +1919,9 @@ save_image (const gchar *filename,
return FALSE;
}
name = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
drawable = gimp_drawable_get (layer);
drawable_type = gimp_drawable_type (layer);

View file

@ -938,7 +938,6 @@ load_image (const gchar *filename)
gint32 layer;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
gchar *status;
gint i, rowstride;
guchar *pixels, *buf;
@ -954,10 +953,9 @@ load_image (const gchar *filename)
gimp_quit ();
}
status = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (status);
g_free (status);
image = gimp_image_new (width, height, GIMP_RGB);
gimp_image_set_filename (image, filename);

View file

@ -703,11 +703,9 @@ load_image (const gchar *filename)
gint y_hot = 0;
gint c, i, j, k;
gint tileheight, rowoffset;
gchar *name_buf;
gchar *comment;
guchar cmap[] =
const guchar cmap[] =
{
0x00, 0x00, 0x00, /* black */
0xff, 0xff, 0xff /* white */
@ -721,10 +719,9 @@ load_image (const gchar *filename)
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
comment = fgetcomment (fp);

View file

@ -336,13 +336,10 @@ load_image (const gchar *filename)
XpmImage xpm_image;
guchar *cmap;
gint32 image_ID;
gchar *name;
/* put up a progress bar */
name = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
/* read the raw file */
switch (XpmReadFileToXpmImage ((char *) filename, &xpm_image, NULL))
@ -621,15 +618,9 @@ save_image (const gchar *filename,
hash = g_hash_table_new ((GHashFunc) rgbhash, (GCompareFunc) compare);
/* put up a progress bar */
{
gchar *name;
name = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
}
ncolors = alpha ? 1 : 0;

View file

@ -411,7 +411,6 @@ load_image (const gchar *filename)
{
FILE *ifp;
gint depth, bpp;
gchar *temp;
gint32 image_ID;
L_XWDFILEHEADER xwdhdr;
L_XWDCOLOR *xwdcolmap = NULL;
@ -472,10 +471,9 @@ load_image (const gchar *filename)
}
}
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
depth = xwdhdr.l_pixmap_depth;
bpp = xwdhdr.l_bits_per_pixel;
@ -523,17 +521,10 @@ load_image (const gchar *filename)
g_free (xwdcolmap);
if (image_ID == -1)
{
temp = g_strdup_printf (_("XWD-file %s has format %d, depth %d\n"
"and bits per pixel %d.\n"
g_message (_("XWD-file %s has format %d, depth %d and bits per pixel %d. "
"Currently this is not supported."),
gimp_filename_to_utf8 (filename),
(gint) xwdhdr.l_pixmap_format, depth, bpp);
g_message (temp);
g_free (temp);
return -1;
}
return image_ID;
}

View file

@ -195,15 +195,13 @@ load_image (const gchar *filename)
gint bperrow = MAX_COLS/8; /* bytes per bit row */
gchar *bitmap; /* MAX_ROWS by (bperrow) bytes */
gchar *bp; /* bitmap pointer */
gchar *name;
gint row;
gint max_rows; /* max. rows allocated */
gint col, hcol; /* column, highest column ever used */
name = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
/* initialize lookup trees */
build_tree( &white, t_white );

View file

@ -443,7 +443,6 @@ load_image (const gchar *filename,
gint32 to_frame)
{
FILE *file;
gchar *name_buf;
GimpDrawable *drawable;
gint32 image_id, layer_ID;
@ -462,10 +461,9 @@ load_image (const gchar *filename,
return -1;
}
name_buf = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
fli_read_header (file, &fli_header);
if (fli_header.magic == NO_HEADER)
@ -524,7 +522,8 @@ load_image (const gchar *filename,
*/
for (cnt = from_frame; cnt <= to_frame; cnt++)
{
name_buf = g_strdup_printf (_("Frame (%i)"), cnt);
gchar *name_buf = g_strdup_printf (_("Frame (%i)"), cnt);
layer_ID = gimp_layer_new (image_id, name_buf,
fli_header.width, fli_header.height,
GIMP_INDEXED_IMAGE, 100, GIMP_NORMAL_MODE);
@ -581,7 +580,6 @@ save_image (const gchar *filename,
gint32 to_frame)
{
FILE *file;
gchar *name_buf;
GimpDrawable *drawable;
gint32 *framelist;
gint nframes;
@ -679,10 +677,9 @@ save_image (const gchar *filename,
return FALSE;
}
name_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name_buf);
g_free (name_buf);
/*
* First build the fli header.

View file

@ -1282,7 +1282,6 @@ ifs_compose (GimpDrawable *drawable)
gint height = drawable->height;
gint num_bands, band_height, band_y, band_no;
gint i, j;
gchar *buffer;
guchar *data;
guchar *mask = NULL;
guchar *nhits;
@ -1317,10 +1316,9 @@ ifs_compose (GimpDrawable *drawable)
gpointer pr;
buffer = g_strdup_printf (_("Rendering IFS (%d/%d)..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Rendering IFS (%d/%d)..."),
band_no+1, num_bands);
gimp_progress_init (buffer);
g_free (buffer);
/* render the band to a buffer */
if (band_y + band_height > height)
@ -1336,11 +1334,9 @@ ifs_compose (GimpDrawable *drawable)
/* transfer the image to the drawable */
buffer = g_strdup_printf (_("Copying IFS to image (%d/%d)..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Copying IFS to image (%d/%d)..."),
band_no+1, num_bands);
gimp_progress_init (buffer);
g_free (buffer);
progress = 0;
max_progress = band_height * width;

View file

@ -137,11 +137,9 @@ load_image (const gchar *filename,
if (!preview)
{
gchar *name = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
}
image_ID = -1;
@ -568,12 +566,9 @@ load_thumbnail_image (const gchar *filename,
jerr.pub.emit_message = my_emit_message;
jerr.pub.output_message = my_output_message;
{
gchar *name = g_strdup_printf (_("Opening thumbnail for '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening thumbnail for '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
}
/* Establish the setjmp return context for my_error_exit to use. */
if (setjmp (jerr.setjmp_buffer))

View file

@ -196,7 +196,6 @@ save_image (const gchar *filename,
guchar *temp, *t;
guchar *data;
guchar *src, *s;
gchar *name;
gboolean has_alpha;
gint rowstride, yend;
gint i, j;
@ -212,10 +211,9 @@ save_image (const gchar *filename,
if (!preview)
{
name = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (name);
g_free (name);
}
/* Step 1: allocate and initialize JPEG compression object */

View file

@ -306,7 +306,6 @@ load_image (const gchar *filename) /* I - File to load */
*pixel, /* Pixel data */
*pptr; /* Current pixel */
gushort **rows; /* SGI image data */
gchar *progress; /* Title for progress display... */
/*
* Open the file for reading...
@ -320,10 +319,9 @@ load_image (const gchar *filename) /* I - File to load */
return -1;
};
progress = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progress);
g_free (progress);
/*
* Get the image dimensions and create the image...
@ -498,7 +496,6 @@ save_image (const gchar *filename,
*pixel, /* Pixel data */
*pptr; /* Current pixel */
gushort **rows; /* SGI image data */
gchar *progress; /* Title for progress display... */
/*
* Get the drawable for the current image...
@ -542,10 +539,9 @@ save_image (const gchar *filename,
return FALSE;
};
progress = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (progress);
g_free (progress);
/*
* Allocate memory for "tile_height" rows...

View file

@ -220,16 +220,13 @@ copy_uri (const gchar *src_uri,
memsize = gimp_memsize_to_string (file_size);
if (file_size > 0)
message = g_strdup_printf (copying_format_str, memsize);
else
message = g_strdup_printf (copied_format_str, memsize);
gimp_progress_init (NULL);
gimp_progress_set_text (file_size > 0 ?
copying_format_str : copied_format_str,
memsize);
g_free (memsize);
gimp_progress_init (message);
g_free (message);
while (TRUE)
{
GnomeVFSFileSize chunk_read;

View file

@ -119,7 +119,6 @@ uri_backend_load_image (const gchar *uri,
gchar *memsize;
gchar *message;
gchar *timeout_msg;
gchar *progress;
#define DEBUG(x) if (debug) g_printerr (x)
@ -153,10 +152,9 @@ uri_backend_load_image (const gchar *uri,
timeout_msg = g_strdup_printf (_("(timeout is %s seconds)"), TIMEOUT);
progress = g_strdup_printf ("%s %s",
gimp_progress_init (NULL);
gimp_progress_set_text ("%s %s",
_("Connecting to server..."), timeout_msg);
gimp_progress_init (progress);
g_free (progress);
read_connect:
if (fgets (buf, sizeof (buf), input) == NULL)
@ -179,10 +177,8 @@ uri_backend_load_image (const gchar *uri,
DEBUG (buf);
/* The fourth line is either the network request or an error */
progress = g_strdup_printf ("%s %s",
_("Opening URI..."), timeout_msg);
gimp_progress_init (progress);
g_free (progress);
gimp_progress_set_text ("%s %s", _("Opening URI..."), timeout_msg);
if (fgets (buf, sizeof (buf), input) == NULL)
{
@ -251,9 +247,7 @@ uri_backend_load_image (const gchar *uri,
message = g_strdup_printf (_("Downloading %s of image data..."),
memsize);
progress = g_strdup_printf ("%s %s", message, timeout_msg);
gimp_progress_init (progress);
g_free (progress);
gimp_progress_set_text ("%s %s", message, timeout_msg);
g_free (message);
g_free (memsize);

View file

@ -498,14 +498,12 @@ ico_to_gimp (MsIcon *ico)
gint32
LoadICO (const gchar *filename)
{
gchar *temp;
gint32 image_ID;
MsIcon ico;
temp = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp);
g_free (temp);
if (! ico_init (filename, &ico))
return -1;

View file

@ -931,7 +931,6 @@ SaveICO (const gchar *filename,
gint32 image)
{
MsIcon ico;
gchar *temp_buf;
gint *icon_depths = NULL;
gint num_icons;
GimpPDBStatusType exit_state;
@ -954,10 +953,9 @@ SaveICO (const gchar *filename,
if ((icon_depths = ico_show_icon_dialog (image, &num_icons)) == NULL)
return GIMP_PDB_CANCEL;
temp_buf = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (temp_buf);
g_free (temp_buf);
/* Okay, let's actually save the thing with the depths the
user specified. */

View file

@ -1633,7 +1633,6 @@ save_xjt_image (const gchar *filename,
gchar *l_prop_file;
gchar *l_jpg_file;
gchar *l_cmd;
gchar *l_name;
FILE *l_fp_prp;
mode_t l_mode_dir;
@ -1684,10 +1683,9 @@ save_xjt_image (const gchar *filename,
break;
}
l_name = g_strdup_printf (_("Saving '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Saving '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (l_name);
g_free (l_name);
/* create temporary directory */
l_dirname = gimp_temp_name (".tmpdir");
@ -3284,7 +3282,6 @@ load_xjt_image (const gchar *filename)
gchar *l_prop_file;
gchar *l_jpg_file;
gchar *l_cmd;
gchar *l_name;
mode_t l_mode_dir;
gint32 *l_layers_list;
@ -3314,10 +3311,9 @@ 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 */
l_name = g_strdup_printf (_("Opening '%s'..."),
gimp_progress_init (NULL);
gimp_progress_set_text (_("Opening '%s'..."),
gimp_filename_to_utf8 (filename));
gimp_progress_init (l_name);
g_free (l_name);
/* create temporary directory */
l_dirname = gimp_temp_name (".tmpdir");

View file

@ -136,7 +136,8 @@ HELP
@inargs = (
{ name => 'message', type => 'string', null_ok => 1,
desc => 'Message to use in the progress dialog' }
desc => 'Message to use in the progress dialog',
wrap => 1 }
);
%invoke = (
code => <<'CODE'