~ubuntu-branches/ubuntu/jaunty/gimp/jaunty-security

« back to all changes in this revision

Viewing changes to app/pdb/gimpprocedure.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2008-10-06 13:30:41 UTC
  • mto: This revision was merged to the branch mainline in revision 35.
  • Revision ID: james.westby@ubuntu.com-20081006133041-3panbkcanaymfsmp
Tags: upstream-2.6.0
ImportĀ upstreamĀ versionĀ 2.6.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#include "config.h"
20
20
 
21
21
#include <stdarg.h>
22
 
#include <string.h>
23
22
#include <sys/types.h>
24
23
 
25
24
#include <glib-object.h>
39
38
 
40
39
#include "vectors/gimpvectors.h"
41
40
 
 
41
#include "gimppdberror.h"
42
42
#include "gimpprocedure.h"
43
43
 
44
44
#include "gimp-intl.h"
53
53
                                                   Gimp           *gimp,
54
54
                                                   GimpContext    *context,
55
55
                                                   GimpProgress   *progress,
56
 
                                                   GValueArray    *args);
 
56
                                                   GValueArray    *args,
 
57
                                                   GError        **error);
57
58
static void    gimp_procedure_real_execute_async  (GimpProcedure  *procedure,
58
59
                                                   Gimp           *gimp,
59
60
                                                   GimpContext    *context,
63
64
 
64
65
static void          gimp_procedure_free_strings  (GimpProcedure  *procedure);
65
66
static gboolean      gimp_procedure_validate_args (GimpProcedure  *procedure,
66
 
                                                   Gimp           *gimp,
67
 
                                                   GimpProgress   *progress,
68
67
                                                   GParamSpec    **param_specs,
69
68
                                                   gint            n_param_specs,
70
69
                                                   GValueArray    *args,
71
 
                                                   gboolean        return_vals);
 
70
                                                   gboolean        return_vals,
 
71
                                                   GError        **error);
72
72
 
73
73
 
74
74
G_DEFINE_TYPE (GimpProcedure, gimp_procedure, GIMP_TYPE_OBJECT)
135
135
 
136
136
  if (! procedure->static_strings)
137
137
    {
138
 
      if (procedure->original_name)
139
 
        memsize += strlen (procedure->original_name) + 1;
140
 
 
141
 
      if (procedure->blurb)
142
 
        memsize += strlen (procedure->blurb) + 1;
143
 
 
144
 
      if (procedure->help)
145
 
        memsize += strlen (procedure->help) + 1;
146
 
 
147
 
      if (procedure->author)
148
 
        memsize += strlen (procedure->author) + 1;
149
 
 
150
 
      if (procedure->copyright)
151
 
        memsize += strlen (procedure->copyright) + 1;
152
 
 
153
 
      if (procedure->date)
154
 
        memsize += strlen (procedure->date) + 1;
155
 
 
156
 
      if (procedure->deprecated)
157
 
        memsize += strlen (procedure->deprecated) + 1;
 
138
      memsize += gimp_string_get_memsize (procedure->original_name);
 
139
      memsize += gimp_string_get_memsize (procedure->blurb);
 
140
      memsize += gimp_string_get_memsize (procedure->help);
 
141
      memsize += gimp_string_get_memsize (procedure->author);
 
142
      memsize += gimp_string_get_memsize (procedure->copyright);
 
143
      memsize += gimp_string_get_memsize (procedure->date);
 
144
      memsize += gimp_string_get_memsize (procedure->deprecated);
158
145
    }
159
146
 
160
147
  memsize += procedure->num_args * sizeof (GParamSpec *);
172
159
}
173
160
 
174
161
static GValueArray *
175
 
gimp_procedure_real_execute (GimpProcedure *procedure,
176
 
                             Gimp          *gimp,
177
 
                             GimpContext   *context,
178
 
                             GimpProgress  *progress,
179
 
                             GValueArray   *args)
 
162
gimp_procedure_real_execute (GimpProcedure  *procedure,
 
163
                             Gimp           *gimp,
 
164
                             GimpContext    *context,
 
165
                             GimpProgress   *progress,
 
166
                             GValueArray    *args,
 
167
                             GError        **error)
180
168
{
181
169
  g_return_val_if_fail (args->n_values >= procedure->num_args, NULL);
182
170
 
183
171
  return procedure->marshal_func (procedure, gimp,
184
172
                                  context, progress,
185
 
                                  args);
 
173
                                  args, error);
186
174
}
187
175
 
188
176
static void
189
 
gimp_procedure_real_execute_async (GimpProcedure *procedure,
190
 
                                   Gimp          *gimp,
191
 
                                   GimpContext   *context,
192
 
                                   GimpProgress  *progress,
193
 
                                   GValueArray   *args,
194
 
                                   GimpObject    *display)
 
177
gimp_procedure_real_execute_async (GimpProcedure  *procedure,
 
178
                                   Gimp           *gimp,
 
179
                                   GimpContext    *context,
 
180
                                   GimpProgress   *progress,
 
181
                                   GValueArray    *args,
 
182
                                   GimpObject     *display)
195
183
{
196
184
  GValueArray *return_vals;
 
185
  GError      *error = NULL;
197
186
 
198
187
  g_return_if_fail (args->n_values >= procedure->num_args);
199
188
 
201
190
                                                               gimp,
202
191
                                                               context,
203
192
                                                               progress,
204
 
                                                               args);
 
193
                                                               args,
 
194
                                                               &error);
205
195
 
206
196
  g_value_array_free (return_vals);
 
197
 
 
198
  if (error)
 
199
    {
 
200
      gimp_message (gimp, G_OBJECT (progress), GIMP_MESSAGE_ERROR,
 
201
                    "%s", error->message);
 
202
      g_error_free (error);
 
203
    }
207
204
}
208
205
 
209
206
 
250
247
 
251
248
void
252
249
gimp_procedure_set_static_strings (GimpProcedure *procedure,
253
 
                                   gchar         *original_name,
254
 
                                   gchar         *blurb,
255
 
                                   gchar         *help,
256
 
                                   gchar         *author,
257
 
                                   gchar         *copyright,
258
 
                                   gchar         *date,
259
 
                                   gchar         *deprecated)
 
250
                                   const gchar   *original_name,
 
251
                                   const gchar   *blurb,
 
252
                                   const gchar   *help,
 
253
                                   const gchar   *author,
 
254
                                   const gchar   *copyright,
 
255
                                   const gchar   *date,
 
256
                                   const gchar   *deprecated)
260
257
{
261
258
  g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
262
259
 
263
260
  gimp_procedure_free_strings (procedure);
264
261
 
265
 
  procedure->original_name = original_name;
266
 
  procedure->blurb         = blurb;
267
 
  procedure->help          = help;
268
 
  procedure->author        = author;
269
 
  procedure->copyright     = copyright;
270
 
  procedure->date          = date;
271
 
  procedure->deprecated    = deprecated;
 
262
  procedure->original_name = (gchar *) original_name;
 
263
  procedure->blurb         = (gchar *) blurb;
 
264
  procedure->help          = (gchar *) help;
 
265
  procedure->author        = (gchar *) author;
 
266
  procedure->copyright     = (gchar *) copyright;
 
267
  procedure->date          = (gchar *) date;
 
268
  procedure->deprecated    = (gchar *) deprecated;
272
269
 
273
270
  procedure->static_strings = TRUE;
274
271
}
299
296
}
300
297
 
301
298
GValueArray *
302
 
gimp_procedure_execute (GimpProcedure *procedure,
303
 
                        Gimp          *gimp,
304
 
                        GimpContext   *context,
305
 
                        GimpProgress  *progress,
306
 
                        GValueArray   *args)
 
299
gimp_procedure_execute (GimpProcedure  *procedure,
 
300
                        Gimp           *gimp,
 
301
                        GimpContext    *context,
 
302
                        GimpProgress   *progress,
 
303
                        GValueArray    *args,
 
304
                        GError        **error)
307
305
{
308
 
  GValueArray *return_vals = NULL;
 
306
  GValueArray *return_vals;
 
307
  GError      *pdb_error = NULL;
309
308
 
310
309
  g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure), NULL);
311
310
  g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
312
311
  g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
313
312
  g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
314
313
  g_return_val_if_fail (args != NULL, NULL);
 
314
  g_return_val_if_fail (error == NULL || *error == NULL, NULL);
315
315
 
316
 
  if (! gimp_procedure_validate_args (procedure, gimp, progress,
 
316
  if (! gimp_procedure_validate_args (procedure,
317
317
                                      procedure->args, procedure->num_args,
318
 
                                      args, FALSE))
 
318
                                      args, FALSE, &pdb_error))
319
319
    {
320
 
      return_vals = gimp_procedure_get_return_values (procedure, FALSE);
321
 
      g_value_set_enum (return_vals->values, GIMP_PDB_CALLING_ERROR);
 
320
      return_vals = gimp_procedure_get_return_values (procedure, FALSE,
 
321
                                                      pdb_error);
 
322
      g_propagate_error (error, pdb_error);
322
323
 
323
324
      return return_vals;
324
325
    }
328
329
                                                               gimp,
329
330
                                                               context,
330
331
                                                               progress,
331
 
                                                               args);
332
 
 
333
 
  /*  If there are no return arguments, assume an execution error  */
334
 
  if (! return_vals)
335
 
    {
336
 
      return_vals = gimp_procedure_get_return_values (procedure, FALSE);
337
 
      g_value_set_enum (return_vals->values, GIMP_PDB_EXECUTION_ERROR);
338
 
 
339
 
      return return_vals;
 
332
                                                               args,
 
333
                                                               error);
 
334
 
 
335
 
 
336
  if (return_vals)
 
337
    {
 
338
      if (g_value_get_enum (&return_vals->values[0]) != GIMP_PDB_SUCCESS)
 
339
        {
 
340
          /*  If the error has not already been set, construct one
 
341
           *  from the error message that is optionally passed with
 
342
           *  the return values.
 
343
           */
 
344
          if (error && *error == NULL)
 
345
            {
 
346
              if (return_vals->n_values > 1 &&
 
347
                  G_VALUE_HOLDS_STRING (&return_vals->values[1]))
 
348
                {
 
349
                  g_set_error (error, 0, 0,
 
350
                               g_value_get_string (&return_vals->values[1]));
 
351
                }
 
352
            }
 
353
        }
 
354
    }
 
355
  else
 
356
    {
 
357
      g_warning ("%s: no return values, shouldn't happen", G_STRFUNC);
 
358
 
 
359
      pdb_error = g_error_new (GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE,
 
360
                               _("Procedure '%s' returned no return values"),
 
361
                               gimp_object_get_name (GIMP_OBJECT (procedure)));
 
362
 
 
363
      return_vals = gimp_procedure_get_return_values (procedure, FALSE,
 
364
                                                      pdb_error);
 
365
      if (error && *error == NULL)
 
366
        g_propagate_error (error, pdb_error);
 
367
      else
 
368
        g_error_free (pdb_error);
 
369
 
340
370
    }
341
371
 
342
372
  return return_vals;
343
373
}
344
374
 
345
375
void
346
 
gimp_procedure_execute_async (GimpProcedure *procedure,
347
 
                              Gimp          *gimp,
348
 
                              GimpContext   *context,
349
 
                              GimpProgress  *progress,
350
 
                              GValueArray   *args,
351
 
                              GimpObject    *display)
 
376
gimp_procedure_execute_async (GimpProcedure  *procedure,
 
377
                              Gimp           *gimp,
 
378
                              GimpContext    *context,
 
379
                              GimpProgress   *progress,
 
380
                              GValueArray    *args,
 
381
                              GimpObject     *display,
 
382
                              GError        **error)
352
383
{
353
384
  g_return_if_fail (GIMP_IS_PROCEDURE (procedure));
354
385
  g_return_if_fail (GIMP_IS_GIMP (gimp));
356
387
  g_return_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress));
357
388
  g_return_if_fail (args != NULL);
358
389
  g_return_if_fail (display == NULL || GIMP_IS_OBJECT (display));
 
390
  g_return_if_fail (error == NULL || *error == NULL);
359
391
 
360
 
  if (gimp_procedure_validate_args (procedure, gimp, progress,
 
392
  if (gimp_procedure_validate_args (procedure,
361
393
                                    procedure->args, procedure->num_args,
362
 
                                    args, FALSE))
 
394
                                    args, FALSE, error))
363
395
    {
364
396
      GIMP_PROCEDURE_GET_CLASS (procedure)->execute_async (procedure, gimp,
365
397
                                                           context, progress,
390
422
 
391
423
GValueArray *
392
424
gimp_procedure_get_return_values (GimpProcedure *procedure,
393
 
                                  gboolean       success)
 
425
                                  gboolean       success,
 
426
                                  const GError  *error)
394
427
{
395
428
  GValueArray *args;
396
429
  GValue       value = { 0, };
397
 
  gint         n_args;
398
430
  gint         i;
399
431
 
400
 
  g_return_val_if_fail (GIMP_IS_PROCEDURE (procedure) ||
401
 
                        success == FALSE, NULL);
402
 
 
403
 
  if (procedure)
404
 
    n_args = procedure->num_values + 1;
 
432
  g_return_val_if_fail (success == FALSE || GIMP_IS_PROCEDURE (procedure),
 
433
                        NULL);
 
434
 
 
435
  if (success)
 
436
    {
 
437
      args = g_value_array_new (procedure->num_values + 1);
 
438
 
 
439
      g_value_init (&value, GIMP_TYPE_PDB_STATUS_TYPE);
 
440
      g_value_set_enum (&value, GIMP_PDB_SUCCESS);
 
441
      g_value_array_append (args, &value);
 
442
      g_value_unset (&value);
 
443
 
 
444
      for (i = 0; i < procedure->num_values; i++)
 
445
        {
 
446
          g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (procedure->values[i]));
 
447
          g_value_array_append (args, &value);
 
448
          g_value_unset (&value);
 
449
        }
 
450
    }
405
451
  else
406
 
    n_args = 1;
407
 
 
408
 
  args = g_value_array_new (n_args);
409
 
 
410
 
  g_value_init (&value, GIMP_TYPE_PDB_STATUS_TYPE);
411
 
  g_value_set_enum (&value,
412
 
                    success ? GIMP_PDB_SUCCESS : GIMP_PDB_EXECUTION_ERROR);
413
 
  g_value_array_append (args, &value);
414
 
  g_value_unset (&value);
415
 
 
416
 
  if (procedure)
417
 
    for (i = 0; i < procedure->num_values; i++)
418
 
      {
419
 
        g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (procedure->values[i]));
420
 
        g_value_array_append (args, &value);
421
 
        g_value_unset (&value);
422
 
      }
 
452
    {
 
453
      args = g_value_array_new ((error && error->message) ? 2 : 1);
 
454
 
 
455
      g_value_init (&value, GIMP_TYPE_PDB_STATUS_TYPE);
 
456
 
 
457
      /*  errors in the GIMP_PDB_ERROR domain are calling errors  */
 
458
      if (error && error->domain == GIMP_PDB_ERROR)
 
459
        {
 
460
          switch ((GimpPdbErrorCode) error->code)
 
461
            {
 
462
            case GIMP_PDB_PROCEDURE_NOT_FOUND:
 
463
            case GIMP_PDB_INVALID_ARGUMENT:
 
464
            case GIMP_PDB_INVALID_RETURN_VALUE:
 
465
            case GIMP_PDB_INTERNAL_ERROR:
 
466
              g_value_set_enum (&value, GIMP_PDB_CALLING_ERROR);
 
467
              break;
 
468
 
 
469
            case GIMP_PDB_CANCELLED:
 
470
              g_value_set_enum (&value, GIMP_PDB_CANCEL);
 
471
              break;
 
472
 
 
473
            default:
 
474
              g_assert_not_reached ();
 
475
            }
 
476
        }
 
477
      else
 
478
        {
 
479
          g_value_set_enum (&value, GIMP_PDB_EXECUTION_ERROR);
 
480
        }
 
481
 
 
482
      g_value_array_append (args, &value);
 
483
      g_value_unset (&value);
 
484
 
 
485
      if (error && error->message)
 
486
        {
 
487
          g_value_init (&value, G_TYPE_STRING);
 
488
          g_value_set_string (&value, error->message);
 
489
          g_value_array_append (args, &value);
 
490
          g_value_unset (&value);
 
491
        }
 
492
    }
423
493
 
424
494
  return args;
425
495
}
490
560
 
491
561
static gboolean
492
562
gimp_procedure_validate_args (GimpProcedure  *procedure,
493
 
                              Gimp           *gimp,
494
 
                              GimpProgress   *progress,
495
563
                              GParamSpec    **param_specs,
496
564
                              gint            n_param_specs,
497
565
                              GValueArray    *args,
498
 
                              gboolean        return_vals)
 
566
                              gboolean        return_vals,
 
567
                              GError        **error)
499
568
{
500
569
  gint i;
501
570
 
510
579
        {
511
580
          if (return_vals)
512
581
            {
513
 
              gimp_message (gimp, G_OBJECT (progress),
514
 
                            GIMP_MESSAGE_ERROR,
515
 
                            _("Procedure '%s' returned a wrong value type "
516
 
                              "for return value '%s' (#%d). "
517
 
                              "Expected %s, got %s."),
518
 
                            gimp_object_get_name (GIMP_OBJECT (procedure)),
519
 
                            g_param_spec_get_name (pspec),
520
 
                            i + 1, g_type_name (spec_type),
521
 
                            g_type_name (arg_type));
 
582
              g_set_error (error,
 
583
                           GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE,
 
584
                           _("Procedure '%s' returned a wrong value type "
 
585
                             "for return value '%s' (#%d). "
 
586
                             "Expected %s, got %s."),
 
587
                           gimp_object_get_name (GIMP_OBJECT (procedure)),
 
588
                           g_param_spec_get_name (pspec),
 
589
                           i + 1, g_type_name (spec_type),
 
590
                           g_type_name (arg_type));
522
591
            }
523
592
          else
524
593
            {
525
 
              gimp_message (gimp, G_OBJECT (progress),
526
 
                            GIMP_MESSAGE_ERROR,
527
 
                            _("Procedure '%s' has been called with a "
528
 
                              "wrong value type for argument '%s' (#%d). "
529
 
                              "Expected %s, got %s."),
530
 
                            gimp_object_get_name (GIMP_OBJECT (procedure)),
531
 
                            g_param_spec_get_name (pspec),
532
 
                            i + 1, g_type_name (spec_type),
533
 
                            g_type_name (arg_type));
 
594
              g_set_error (error,
 
595
                           GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
 
596
                           _("Procedure '%s' has been called with a "
 
597
                             "wrong value type for argument '%s' (#%d). "
 
598
                             "Expected %s, got %s."),
 
599
                           gimp_object_get_name (GIMP_OBJECT (procedure)),
 
600
                           g_param_spec_get_name (pspec),
 
601
                           i + 1, g_type_name (spec_type),
 
602
                           g_type_name (arg_type));
534
603
            }
535
604
 
536
605
          return FALSE;
554
623
                {
555
624
                  if (return_vals)
556
625
                    {
557
 
                      gimp_message (gimp, G_OBJECT (progress),
558
 
                                    GIMP_MESSAGE_ERROR,
559
 
                                    _("Procedure '%s' returned an "
560
 
                                      "invalid ID for argument '%s'. "
561
 
                                      "Most likely a plug-in is trying "
562
 
                                      "to work on a layer that doesn't "
563
 
                                      "exist any longer."),
564
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
565
 
                                    g_param_spec_get_name (pspec));
 
626
                      g_set_error (error,
 
627
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE,
 
628
                                   _("Procedure '%s' returned an "
 
629
                                     "invalid ID for argument '%s'. "
 
630
                                     "Most likely a plug-in is trying "
 
631
                                     "to work on a layer that doesn't "
 
632
                                     "exist any longer."),
 
633
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
634
                                   g_param_spec_get_name (pspec));
566
635
                    }
567
636
                  else
568
637
                    {
569
 
                      gimp_message (gimp, G_OBJECT (progress),
570
 
                                    GIMP_MESSAGE_ERROR,
571
 
                                    _("Procedure '%s' has been called with an "
572
 
                                      "invalid ID for argument '%s'. "
573
 
                                      "Most likely a plug-in is trying "
574
 
                                      "to work on a layer that doesn't "
575
 
                                      "exist any longer."),
576
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
577
 
                                    g_param_spec_get_name (pspec));
 
638
                      g_set_error (error,
 
639
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
 
640
                                   _("Procedure '%s' has been called with an "
 
641
                                     "invalid ID for argument '%s'. "
 
642
                                     "Most likely a plug-in is trying "
 
643
                                     "to work on a layer that doesn't "
 
644
                                     "exist any longer."),
 
645
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
646
                                   g_param_spec_get_name (pspec));
578
647
                    }
579
648
                }
580
649
              else if (GIMP_IS_PARAM_SPEC_IMAGE_ID (pspec) &&
582
651
                {
583
652
                  if (return_vals)
584
653
                    {
585
 
                      gimp_message (gimp, G_OBJECT (progress),
586
 
                                    GIMP_MESSAGE_ERROR,
587
 
                                    _("Procedure '%s' returned an "
588
 
                                      "invalid ID for argument '%s'. "
589
 
                                      "Most likely a plug-in is trying "
590
 
                                      "to work on an image that doesn't "
591
 
                                      "exist any longer."),
592
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
593
 
                                    g_param_spec_get_name (pspec));
 
654
                      g_set_error (error,
 
655
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE,
 
656
                                   _("Procedure '%s' returned an "
 
657
                                     "invalid ID for argument '%s'. "
 
658
                                     "Most likely a plug-in is trying "
 
659
                                     "to work on an image that doesn't "
 
660
                                     "exist any longer."),
 
661
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
662
                                   g_param_spec_get_name (pspec));
594
663
                    }
595
664
                  else
596
665
                    {
597
 
                      gimp_message (gimp, G_OBJECT (progress),
598
 
                                    GIMP_MESSAGE_ERROR,
599
 
                                    _("Procedure '%s' has been called with an "
600
 
                                      "invalid ID for argument '%s'. "
601
 
                                      "Most likely a plug-in is trying "
602
 
                                      "to work on an image that doesn't "
603
 
                                      "exist any longer."),
604
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
605
 
                                    g_param_spec_get_name (pspec));
 
666
                      g_set_error (error,
 
667
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
 
668
                                   _("Procedure '%s' has been called with an "
 
669
                                     "invalid ID for argument '%s'. "
 
670
                                     "Most likely a plug-in is trying "
 
671
                                     "to work on an image that doesn't "
 
672
                                     "exist any longer."),
 
673
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
674
                                   g_param_spec_get_name (pspec));
606
675
                    }
607
676
                }
608
677
              else
614
683
 
615
684
                  if (return_vals)
616
685
                    {
617
 
                      gimp_message (gimp, G_OBJECT (progress),
618
 
                                    GIMP_MESSAGE_ERROR,
619
 
                                    _("Procedure '%s' returned "
620
 
                                      "'%s' as return value '%s' "
621
 
                                      "(#%d, type %s). "
622
 
                                      "This value is out of range."),
623
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
624
 
                                    value,
625
 
                                    g_param_spec_get_name (pspec),
626
 
                                    i + 1, g_type_name (spec_type));
 
686
                      g_set_error (error,
 
687
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_RETURN_VALUE,
 
688
                                   _("Procedure '%s' returned "
 
689
                                     "'%s' as return value '%s' "
 
690
                                     "(#%d, type %s). "
 
691
                                     "This value is out of range."),
 
692
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
693
                                   value,
 
694
                                   g_param_spec_get_name (pspec),
 
695
                                   i + 1, g_type_name (spec_type));
627
696
                    }
628
697
                  else
629
698
                    {
630
 
                      gimp_message (gimp, G_OBJECT (progress),
631
 
                                    GIMP_MESSAGE_ERROR,
632
 
                                    _("Procedure '%s' has been called with "
633
 
                                      "value '%s' for argument '%s' "
634
 
                                      "(#%d, type %s). "
635
 
                                      "This value is out of range."),
636
 
                                    gimp_object_get_name (GIMP_OBJECT (procedure)),
637
 
                                    value,
638
 
                                    g_param_spec_get_name (pspec),
639
 
                                    i + 1, g_type_name (spec_type));
 
699
                      g_set_error (error,
 
700
                                   GIMP_PDB_ERROR, GIMP_PDB_INVALID_ARGUMENT,
 
701
                                   _("Procedure '%s' has been called with "
 
702
                                     "value '%s' for argument '%s' "
 
703
                                     "(#%d, type %s). "
 
704
                                     "This value is out of range."),
 
705
                                   gimp_object_get_name (GIMP_OBJECT (procedure)),
 
706
                                   value,
 
707
                                   g_param_spec_get_name (pspec),
 
708
                                   i + 1, g_type_name (spec_type));
640
709
                    }
641
710
                }
642
711