gimp r28200 - in trunk: . app plug-ins/script-fu



Author: neo
Date: Sun Mar 22 20:49:55 2009
New Revision: 28200
URL: http://svn.gnome.org/viewvc/gimp?rev=28200&view=rev

Log:
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



Modified:
   trunk/ChangeLog
   trunk/app/batch.c
   trunk/plug-ins/script-fu/script-fu-eval.c

Modified: trunk/app/batch.c
==============================================================================
--- trunk/app/batch.c	(original)
+++ trunk/app/batch.c	Sun Mar 22 20:49:55 2009
@@ -168,8 +168,8 @@
     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 @@
     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
         {

Modified: trunk/plug-ins/script-fu/script-fu-eval.c
==============================================================================
--- trunk/plug-ins/script-fu/script-fu-eval.c	(original)
+++ trunk/plug-ins/script-fu/script-fu-eval.c	Sun Mar 22 20:49:55 2009
@@ -32,24 +32,24 @@
                     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 @@
     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 @@
     }
 
   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);
+    }
 }



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