pass error message with the return values instead of calling g_message().

2008-08-20  Sven Neumann  <sven@gimp.org>

	* plug-ins/script-fu/script-fu-console.c (script_fu_eval_run):
	pass error message with the return values instead of calling
	g_message().


svn path=/trunk/; revision=26680
This commit is contained in:
Sven Neumann
2008-08-20 14:45:21 +00:00
committed by Sven Neumann
parent b28a3306e0
commit 05287d057a
2 changed files with 24 additions and 10 deletions

View File

@ -1,3 +1,9 @@
2008-08-20 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-console.c (script_fu_eval_run):
pass error message with the return values instead of calling
g_message().
2008-08-20 Michael Natterer <mitch@gimp.org> 2008-08-20 Michael Natterer <mitch@gimp.org>
* plug-ins/common/align-layers.c * plug-ins/common/align-layers.c

View File

@ -514,10 +514,13 @@ script_fu_output_to_console (TsOutputType type,
if (console && console->text_view) if (console && console->text_view)
{ {
GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (console->text_view)); GtkTextBuffer *buffer;
GtkTextIter cursor; GtkTextIter cursor;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (console->text_view));
gtk_text_buffer_get_end_iter (buffer, &cursor); gtk_text_buffer_get_end_iter (buffer, &cursor);
if (type == TS_OUTPUT_NORMAL) if (type == TS_OUTPUT_NORMAL)
{ {
gtk_text_buffer_insert (buffer, &cursor, text, len); gtk_text_buffer_insert (buffer, &cursor, text, len);
@ -528,6 +531,7 @@ script_fu_output_to_console (TsOutputType type,
text, len, "emphasis", text, len, "emphasis",
NULL); NULL);
} }
script_fu_console_scroll_end (console->text_view); script_fu_console_scroll_end (console->text_view);
} }
} }
@ -697,11 +701,17 @@ script_fu_eval_run (const gchar *name,
gint *nreturn_vals, gint *nreturn_vals,
GimpParam **return_vals) GimpParam **return_vals)
{ {
static GimpParam values[1]; static GimpParam values[2];
GimpPDBStatusType status = GIMP_PDB_SUCCESS; GimpPDBStatusType status = GIMP_PDB_SUCCESS;
GimpRunMode run_mode; GimpRunMode run_mode;
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
run_mode = params[0].data.d_int32; run_mode = params[0].data.d_int32;
set_run_mode_constant (run_mode); set_run_mode_constant (run_mode);
switch (run_mode) switch (run_mode)
@ -710,23 +720,21 @@ script_fu_eval_run (const gchar *name,
/* Disable Script-Fu output */ /* Disable Script-Fu output */
ts_register_output_func (NULL, NULL); ts_register_output_func (NULL, NULL);
if (ts_interpret_string (params[1].data.d_string) != 0) if (ts_interpret_string (params[1].data.d_string) != 0)
status = GIMP_PDB_EXECUTION_ERROR; status = GIMP_PDB_EXECUTION_ERROR;
break; break;
case GIMP_RUN_INTERACTIVE: case GIMP_RUN_INTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS: case GIMP_RUN_WITH_LAST_VALS:
status = GIMP_PDB_CALLING_ERROR; status = GIMP_PDB_CALLING_ERROR;
g_message (_("Script-Fu evaluation mode only allows " *nreturn_vals = 2;
"non-interactive invocation")); values[1].type = GIMP_PDB_STRING;
values[1].data.d_string = _("Script-Fu evaluation mode only allows "
"non-interactive invocation");
break; break;
default: default:
break; break;
} }
*nreturn_vals = 1;
*return_vals = values;
values[0].type = GIMP_PDB_STATUS;
values[0].data.d_status = status; values[0].data.d_status = status;
} }