added a newline to the output in the error case.

2009-03-22  Sven Neumann  <sven@gimp.org>

        * app/batch.c (batch_run_cmd): added a newline to the output in
        the error case.

        * plug-ins/script-fu/script-fu-eval.c (script_fu_eval_run):
        instead of disabling all output in batch mode, use the usual
        routine for error handling and pass the error string along with


svn path=/trunk/; revision=28200
This commit is contained in:
Sven Neumann 2009-03-22 20:49:55 +00:00 committed by Sven Neumann
parent e6af54a687
commit a85bbe7fec
3 changed files with 33 additions and 14 deletions

View File

@ -1,3 +1,13 @@
2009-03-22 Sven Neumann <sven@gimp.org>
* app/batch.c (batch_run_cmd): added a newline to the output in
the error case.
* plug-ins/script-fu/script-fu-eval.c (script_fu_eval_run):
instead of disabling all output in batch mode, use the usual
routine for error handling and pass the error string along with
the return values.
2009-03-22 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpscrolledpreview.c: use GtkAdjustment's

View File

@ -168,8 +168,8 @@ batch_run_cmd (Gimp *gimp,
case GIMP_PDB_EXECUTION_ERROR:
if (error)
{
g_printerr ("batch command experienced an execution error: %s\n",
error->message);
g_printerr ("batch command experienced an execution error:\n"
"%s\n", error->message);
}
else
{
@ -180,8 +180,8 @@ batch_run_cmd (Gimp *gimp,
case GIMP_PDB_CALLING_ERROR:
if (error)
{
g_printerr ("batch command experienced a calling error: %s\n",
error->message);
g_printerr ("batch command experienced a calling error:\n"
"%s\n", error->message);
}
else
{

View File

@ -32,24 +32,24 @@ script_fu_eval_run (const gchar *name,
gint *nreturn_vals,
GimpParam **return_vals)
{
static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
static GimpParam values[2];
GString *output = g_string_new (NULL);
GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
run_mode = params[0].data.d_int32;
ts_set_run_mode (run_mode);
ts_register_output_func (ts_gstring_output_func, output);
switch (run_mode)
{
case GIMP_RUN_NONINTERACTIVE:
/* Disable Script-Fu output */
ts_register_output_func (NULL, NULL);
if (ts_interpret_string (params[1].data.d_string) != 0)
status = GIMP_PDB_EXECUTION_ERROR;
break;
@ -57,10 +57,8 @@ script_fu_eval_run (const gchar *name,
case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS:
status = GIMP_PDB_CALLING_ERROR;
*nreturn_vals = 2;
values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = _("Script-Fu evaluation mode only allows "
"non-interactive invocation");
g_string_assign (output, _("Script-Fu evaluation mode only allows "
"non-interactive invocation"));
break;
default:
@ -68,4 +66,15 @@ script_fu_eval_run (const gchar *name,
}
values[0].data.d_status = status;
if (status != GIMP_PDB_SUCCESS && output->len > 0)
{
*nreturn_vals = 2;
values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = g_string_free (output, FALSE);
}
else
{
g_string_free (output, TRUE);
}
}