~ubuntu-branches/ubuntu/maverick/gimp/maverick-updates

« back to all changes in this revision

Viewing changes to app/pdb/parasite_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2005-12-09 19:44:52 UTC
  • Revision ID: james.westby@ubuntu.com-20051209194452-yggpemjlofpjqyf4
Tags: upstream-2.2.9
ImportĀ upstreamĀ versionĀ 2.2.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* The GIMP -- an image manipulation program
 
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 *
 
9
 * This program is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 * GNU General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
17
 */
 
18
 
 
19
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
20
 
 
21
#include "config.h"
 
22
 
 
23
 
 
24
#include <glib-object.h>
 
25
 
 
26
#include "libgimpbase/gimpbase.h"
 
27
 
 
28
#include "pdb-types.h"
 
29
#include "procedural_db.h"
 
30
 
 
31
#include "core/gimp-parasites.h"
 
32
#include "core/gimpdrawable.h"
 
33
#include "core/gimpimage.h"
 
34
 
 
35
static ProcRecord parasite_find_proc;
 
36
static ProcRecord parasite_attach_proc;
 
37
static ProcRecord parasite_detach_proc;
 
38
static ProcRecord parasite_list_proc;
 
39
static ProcRecord drawable_parasite_find_proc;
 
40
static ProcRecord drawable_parasite_attach_proc;
 
41
static ProcRecord drawable_parasite_detach_proc;
 
42
static ProcRecord drawable_parasite_list_proc;
 
43
static ProcRecord image_parasite_find_proc;
 
44
static ProcRecord image_parasite_attach_proc;
 
45
static ProcRecord image_parasite_detach_proc;
 
46
static ProcRecord image_parasite_list_proc;
 
47
 
 
48
void
 
49
register_parasite_procs (Gimp *gimp)
 
50
{
 
51
  procedural_db_register (gimp, &parasite_find_proc);
 
52
  procedural_db_register (gimp, &parasite_attach_proc);
 
53
  procedural_db_register (gimp, &parasite_detach_proc);
 
54
  procedural_db_register (gimp, &parasite_list_proc);
 
55
  procedural_db_register (gimp, &drawable_parasite_find_proc);
 
56
  procedural_db_register (gimp, &drawable_parasite_attach_proc);
 
57
  procedural_db_register (gimp, &drawable_parasite_detach_proc);
 
58
  procedural_db_register (gimp, &drawable_parasite_list_proc);
 
59
  procedural_db_register (gimp, &image_parasite_find_proc);
 
60
  procedural_db_register (gimp, &image_parasite_attach_proc);
 
61
  procedural_db_register (gimp, &image_parasite_detach_proc);
 
62
  procedural_db_register (gimp, &image_parasite_list_proc);
 
63
}
 
64
 
 
65
static Argument *
 
66
parasite_find_invoker (Gimp         *gimp,
 
67
                       GimpContext  *context,
 
68
                       GimpProgress *progress,
 
69
                       Argument     *args)
 
70
{
 
71
  gboolean success = TRUE;
 
72
  Argument *return_args;
 
73
  gchar *name;
 
74
  GimpParasite *parasite = NULL;
 
75
 
 
76
  name = (gchar *) args[0].value.pdb_pointer;
 
77
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
78
    success = FALSE;
 
79
 
 
80
  if (success)
 
81
    {
 
82
      parasite = gimp_parasite_copy (gimp_parasite_find (gimp, name));
 
83
      success = parasite != NULL;
 
84
    }
 
85
 
 
86
  return_args = procedural_db_return_args (&parasite_find_proc, success);
 
87
 
 
88
  if (success)
 
89
    return_args[1].value.pdb_pointer = parasite;
 
90
 
 
91
  return return_args;
 
92
}
 
93
 
 
94
static ProcArg parasite_find_inargs[] =
 
95
{
 
96
  {
 
97
    GIMP_PDB_STRING,
 
98
    "name",
 
99
    "The name of the parasite to find"
 
100
  }
 
101
};
 
102
 
 
103
static ProcArg parasite_find_outargs[] =
 
104
{
 
105
  {
 
106
    GIMP_PDB_PARASITE,
 
107
    "parasite",
 
108
    "The found parasite"
 
109
  }
 
110
};
 
111
 
 
112
static ProcRecord parasite_find_proc =
 
113
{
 
114
  "gimp_parasite_find",
 
115
  "Finds the named parasite.",
 
116
  "Finds and returns the named parasite that was previously attached to the gimp.",
 
117
  "Jay Cox",
 
118
  "Jay Cox",
 
119
  "1998",
 
120
  NULL,
 
121
  GIMP_INTERNAL,
 
122
  1,
 
123
  parasite_find_inargs,
 
124
  1,
 
125
  parasite_find_outargs,
 
126
  { { parasite_find_invoker } }
 
127
};
 
128
 
 
129
static Argument *
 
130
parasite_attach_invoker (Gimp         *gimp,
 
131
                         GimpContext  *context,
 
132
                         GimpProgress *progress,
 
133
                         Argument     *args)
 
134
{
 
135
  gboolean success = TRUE;
 
136
  GimpParasite *parasite;
 
137
 
 
138
  parasite = (GimpParasite *) args[0].value.pdb_pointer;
 
139
  if (parasite == NULL || parasite->name == NULL || !g_utf8_validate (parasite->name, -1, NULL))
 
140
    success = FALSE;
 
141
 
 
142
  if (success)
 
143
    gimp_parasite_attach (gimp, parasite);
 
144
 
 
145
  return procedural_db_return_args (&parasite_attach_proc, success);
 
146
}
 
147
 
 
148
static ProcArg parasite_attach_inargs[] =
 
149
{
 
150
  {
 
151
    GIMP_PDB_PARASITE,
 
152
    "parasite",
 
153
    "The parasite to attach to the gimp"
 
154
  }
 
155
};
 
156
 
 
157
static ProcRecord parasite_attach_proc =
 
158
{
 
159
  "gimp_parasite_attach",
 
160
  "Add a parasite to the gimp.",
 
161
  "This procedure attaches a parasite to the gimp. It has no return values.",
 
162
  "Jay Cox",
 
163
  "Jay Cox",
 
164
  "1998",
 
165
  NULL,
 
166
  GIMP_INTERNAL,
 
167
  1,
 
168
  parasite_attach_inargs,
 
169
  0,
 
170
  NULL,
 
171
  { { parasite_attach_invoker } }
 
172
};
 
173
 
 
174
static Argument *
 
175
parasite_detach_invoker (Gimp         *gimp,
 
176
                         GimpContext  *context,
 
177
                         GimpProgress *progress,
 
178
                         Argument     *args)
 
179
{
 
180
  gboolean success = TRUE;
 
181
  gchar *name;
 
182
 
 
183
  name = (gchar *) args[0].value.pdb_pointer;
 
184
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
185
    success = FALSE;
 
186
 
 
187
  if (success)
 
188
    gimp_parasite_detach (gimp, name);
 
189
 
 
190
  return procedural_db_return_args (&parasite_detach_proc, success);
 
191
}
 
192
 
 
193
static ProcArg parasite_detach_inargs[] =
 
194
{
 
195
  {
 
196
    GIMP_PDB_STRING,
 
197
    "name",
 
198
    "The name of the parasite to detach from the gimp."
 
199
  }
 
200
};
 
201
 
 
202
static ProcRecord parasite_detach_proc =
 
203
{
 
204
  "gimp_parasite_detach",
 
205
  "Removes a parasite from the gimp.",
 
206
  "This procedure detaches a parasite from the gimp. It has no return values.",
 
207
  "Jay Cox",
 
208
  "Jay Cox",
 
209
  "1998",
 
210
  NULL,
 
211
  GIMP_INTERNAL,
 
212
  1,
 
213
  parasite_detach_inargs,
 
214
  0,
 
215
  NULL,
 
216
  { { parasite_detach_invoker } }
 
217
};
 
218
 
 
219
static Argument *
 
220
parasite_list_invoker (Gimp         *gimp,
 
221
                       GimpContext  *context,
 
222
                       GimpProgress *progress,
 
223
                       Argument     *args)
 
224
{
 
225
  Argument *return_args;
 
226
  gint32 num_parasites;
 
227
  gchar **parasites;
 
228
 
 
229
  parasites = gimp_parasite_list (gimp, &num_parasites);
 
230
 
 
231
  return_args = procedural_db_return_args (&parasite_list_proc, TRUE);
 
232
 
 
233
  return_args[1].value.pdb_int = num_parasites;
 
234
  return_args[2].value.pdb_pointer = parasites;
 
235
 
 
236
  return return_args;
 
237
}
 
238
 
 
239
static ProcArg parasite_list_outargs[] =
 
240
{
 
241
  {
 
242
    GIMP_PDB_INT32,
 
243
    "num_parasites",
 
244
    "The number of attached parasites"
 
245
  },
 
246
  {
 
247
    GIMP_PDB_STRINGARRAY,
 
248
    "parasites",
 
249
    "The names of currently attached parasites"
 
250
  }
 
251
};
 
252
 
 
253
static ProcRecord parasite_list_proc =
 
254
{
 
255
  "gimp_parasite_list",
 
256
  "List all parasites.",
 
257
  "Returns a list of all currently attached parasites.",
 
258
  "Marc Lehmann",
 
259
  "Marc Lehmann",
 
260
  "1999",
 
261
  NULL,
 
262
  GIMP_INTERNAL,
 
263
  0,
 
264
  NULL,
 
265
  2,
 
266
  parasite_list_outargs,
 
267
  { { parasite_list_invoker } }
 
268
};
 
269
 
 
270
static Argument *
 
271
drawable_parasite_find_invoker (Gimp         *gimp,
 
272
                                GimpContext  *context,
 
273
                                GimpProgress *progress,
 
274
                                Argument     *args)
 
275
{
 
276
  gboolean success = TRUE;
 
277
  Argument *return_args;
 
278
  GimpDrawable *drawable;
 
279
  gchar *name;
 
280
  GimpParasite *parasite = NULL;
 
281
 
 
282
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
 
283
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
 
284
    success = FALSE;
 
285
 
 
286
  name = (gchar *) args[1].value.pdb_pointer;
 
287
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
288
    success = FALSE;
 
289
 
 
290
  if (success)
 
291
    {
 
292
      parasite = gimp_parasite_copy (gimp_item_parasite_find (GIMP_ITEM (drawable), name));
 
293
      success = parasite != NULL;
 
294
    }
 
295
 
 
296
  return_args = procedural_db_return_args (&drawable_parasite_find_proc, success);
 
297
 
 
298
  if (success)
 
299
    return_args[1].value.pdb_pointer = parasite;
 
300
 
 
301
  return return_args;
 
302
}
 
303
 
 
304
static ProcArg drawable_parasite_find_inargs[] =
 
305
{
 
306
  {
 
307
    GIMP_PDB_DRAWABLE,
 
308
    "drawable",
 
309
    "The drawable"
 
310
  },
 
311
  {
 
312
    GIMP_PDB_STRING,
 
313
    "name",
 
314
    "The name of the parasite to find"
 
315
  }
 
316
};
 
317
 
 
318
static ProcArg drawable_parasite_find_outargs[] =
 
319
{
 
320
  {
 
321
    GIMP_PDB_PARASITE,
 
322
    "parasite",
 
323
    "The found parasite"
 
324
  }
 
325
};
 
326
 
 
327
static ProcRecord drawable_parasite_find_proc =
 
328
{
 
329
  "gimp_drawable_parasite_find",
 
330
  "Finds the named parasite in a drawable",
 
331
  "Finds and returns the named parasite that was previously attached to a drawable.",
 
332
  "Jay Cox",
 
333
  "Jay Cox",
 
334
  "1998",
 
335
  NULL,
 
336
  GIMP_INTERNAL,
 
337
  2,
 
338
  drawable_parasite_find_inargs,
 
339
  1,
 
340
  drawable_parasite_find_outargs,
 
341
  { { drawable_parasite_find_invoker } }
 
342
};
 
343
 
 
344
static Argument *
 
345
drawable_parasite_attach_invoker (Gimp         *gimp,
 
346
                                  GimpContext  *context,
 
347
                                  GimpProgress *progress,
 
348
                                  Argument     *args)
 
349
{
 
350
  gboolean success = TRUE;
 
351
  GimpDrawable *drawable;
 
352
  GimpParasite *parasite;
 
353
 
 
354
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
 
355
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
 
356
    success = FALSE;
 
357
 
 
358
  parasite = (GimpParasite *) args[1].value.pdb_pointer;
 
359
  if (parasite == NULL || parasite->name == NULL || !g_utf8_validate (parasite->name, -1, NULL))
 
360
    success = FALSE;
 
361
 
 
362
  if (success)
 
363
    gimp_item_parasite_attach (GIMP_ITEM (drawable), parasite);
 
364
 
 
365
  return procedural_db_return_args (&drawable_parasite_attach_proc, success);
 
366
}
 
367
 
 
368
static ProcArg drawable_parasite_attach_inargs[] =
 
369
{
 
370
  {
 
371
    GIMP_PDB_DRAWABLE,
 
372
    "drawable",
 
373
    "The drawable"
 
374
  },
 
375
  {
 
376
    GIMP_PDB_PARASITE,
 
377
    "parasite",
 
378
    "The parasite to attach to a drawable"
 
379
  }
 
380
};
 
381
 
 
382
static ProcRecord drawable_parasite_attach_proc =
 
383
{
 
384
  "gimp_drawable_parasite_attach",
 
385
  "Add a parasite to a drawable.",
 
386
  "This procedure attaches a parasite to a drawable. It has no return values.",
 
387
  "Jay Cox",
 
388
  "Jay Cox",
 
389
  "1998",
 
390
  NULL,
 
391
  GIMP_INTERNAL,
 
392
  2,
 
393
  drawable_parasite_attach_inargs,
 
394
  0,
 
395
  NULL,
 
396
  { { drawable_parasite_attach_invoker } }
 
397
};
 
398
 
 
399
static Argument *
 
400
drawable_parasite_detach_invoker (Gimp         *gimp,
 
401
                                  GimpContext  *context,
 
402
                                  GimpProgress *progress,
 
403
                                  Argument     *args)
 
404
{
 
405
  gboolean success = TRUE;
 
406
  GimpDrawable *drawable;
 
407
  gchar *name;
 
408
 
 
409
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
 
410
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
 
411
    success = FALSE;
 
412
 
 
413
  name = (gchar *) args[1].value.pdb_pointer;
 
414
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
415
    success = FALSE;
 
416
 
 
417
  if (success)
 
418
    gimp_item_parasite_detach (GIMP_ITEM (drawable), name);
 
419
 
 
420
  return procedural_db_return_args (&drawable_parasite_detach_proc, success);
 
421
}
 
422
 
 
423
static ProcArg drawable_parasite_detach_inargs[] =
 
424
{
 
425
  {
 
426
    GIMP_PDB_DRAWABLE,
 
427
    "drawable",
 
428
    "The drawable"
 
429
  },
 
430
  {
 
431
    GIMP_PDB_STRING,
 
432
    "name",
 
433
    "The name of the parasite to detach from a drawable."
 
434
  }
 
435
};
 
436
 
 
437
static ProcRecord drawable_parasite_detach_proc =
 
438
{
 
439
  "gimp_drawable_parasite_detach",
 
440
  "Removes a parasite from a drawable.",
 
441
  "This procedure detaches a parasite from a drawable. It has no return values.",
 
442
  "Jay Cox",
 
443
  "Jay Cox",
 
444
  "1998",
 
445
  NULL,
 
446
  GIMP_INTERNAL,
 
447
  2,
 
448
  drawable_parasite_detach_inargs,
 
449
  0,
 
450
  NULL,
 
451
  { { drawable_parasite_detach_invoker } }
 
452
};
 
453
 
 
454
static Argument *
 
455
drawable_parasite_list_invoker (Gimp         *gimp,
 
456
                                GimpContext  *context,
 
457
                                GimpProgress *progress,
 
458
                                Argument     *args)
 
459
{
 
460
  gboolean success = TRUE;
 
461
  Argument *return_args;
 
462
  GimpDrawable *drawable;
 
463
  gint32 num_parasites;
 
464
  gchar **parasites = NULL;
 
465
 
 
466
  drawable = (GimpDrawable *) gimp_item_get_by_ID (gimp, args[0].value.pdb_int);
 
467
  if (! (GIMP_IS_DRAWABLE (drawable) && ! gimp_item_is_removed (GIMP_ITEM (drawable))))
 
468
    success = FALSE;
 
469
 
 
470
  if (success)
 
471
    parasites = gimp_item_parasite_list (GIMP_ITEM (drawable), &num_parasites);
 
472
 
 
473
  return_args = procedural_db_return_args (&drawable_parasite_list_proc, success);
 
474
 
 
475
  if (success)
 
476
    {
 
477
      return_args[1].value.pdb_int = num_parasites;
 
478
      return_args[2].value.pdb_pointer = parasites;
 
479
    }
 
480
 
 
481
  return return_args;
 
482
}
 
483
 
 
484
static ProcArg drawable_parasite_list_inargs[] =
 
485
{
 
486
  {
 
487
    GIMP_PDB_DRAWABLE,
 
488
    "drawable",
 
489
    "The drawable"
 
490
  }
 
491
};
 
492
 
 
493
static ProcArg drawable_parasite_list_outargs[] =
 
494
{
 
495
  {
 
496
    GIMP_PDB_INT32,
 
497
    "num_parasites",
 
498
    "The number of attached parasites"
 
499
  },
 
500
  {
 
501
    GIMP_PDB_STRINGARRAY,
 
502
    "parasites",
 
503
    "The names of currently attached parasites"
 
504
  }
 
505
};
 
506
 
 
507
static ProcRecord drawable_parasite_list_proc =
 
508
{
 
509
  "gimp_drawable_parasite_list",
 
510
  "List all parasites.",
 
511
  "Returns a list of all currently attached parasites.",
 
512
  "Marc Lehmann",
 
513
  "Marc Lehmann",
 
514
  "1999",
 
515
  NULL,
 
516
  GIMP_INTERNAL,
 
517
  1,
 
518
  drawable_parasite_list_inargs,
 
519
  2,
 
520
  drawable_parasite_list_outargs,
 
521
  { { drawable_parasite_list_invoker } }
 
522
};
 
523
 
 
524
static Argument *
 
525
image_parasite_find_invoker (Gimp         *gimp,
 
526
                             GimpContext  *context,
 
527
                             GimpProgress *progress,
 
528
                             Argument     *args)
 
529
{
 
530
  gboolean success = TRUE;
 
531
  Argument *return_args;
 
532
  GimpImage *gimage;
 
533
  gchar *name;
 
534
  GimpParasite *parasite = NULL;
 
535
 
 
536
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
 
537
  if (! GIMP_IS_IMAGE (gimage))
 
538
    success = FALSE;
 
539
 
 
540
  name = (gchar *) args[1].value.pdb_pointer;
 
541
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
542
    success = FALSE;
 
543
 
 
544
  if (success)
 
545
    {
 
546
      parasite = gimp_parasite_copy (gimp_image_parasite_find (gimage, name));
 
547
      success = parasite != NULL;
 
548
    }
 
549
 
 
550
  return_args = procedural_db_return_args (&image_parasite_find_proc, success);
 
551
 
 
552
  if (success)
 
553
    return_args[1].value.pdb_pointer = parasite;
 
554
 
 
555
  return return_args;
 
556
}
 
557
 
 
558
static ProcArg image_parasite_find_inargs[] =
 
559
{
 
560
  {
 
561
    GIMP_PDB_IMAGE,
 
562
    "image",
 
563
    "The image"
 
564
  },
 
565
  {
 
566
    GIMP_PDB_STRING,
 
567
    "name",
 
568
    "The name of the parasite to find"
 
569
  }
 
570
};
 
571
 
 
572
static ProcArg image_parasite_find_outargs[] =
 
573
{
 
574
  {
 
575
    GIMP_PDB_PARASITE,
 
576
    "parasite",
 
577
    "The found parasite"
 
578
  }
 
579
};
 
580
 
 
581
static ProcRecord image_parasite_find_proc =
 
582
{
 
583
  "gimp_image_parasite_find",
 
584
  "Finds the named parasite in an image",
 
585
  "Finds and returns the named parasite that was previously attached to an image.",
 
586
  "Jay Cox",
 
587
  "Jay Cox",
 
588
  "1998",
 
589
  NULL,
 
590
  GIMP_INTERNAL,
 
591
  2,
 
592
  image_parasite_find_inargs,
 
593
  1,
 
594
  image_parasite_find_outargs,
 
595
  { { image_parasite_find_invoker } }
 
596
};
 
597
 
 
598
static Argument *
 
599
image_parasite_attach_invoker (Gimp         *gimp,
 
600
                               GimpContext  *context,
 
601
                               GimpProgress *progress,
 
602
                               Argument     *args)
 
603
{
 
604
  gboolean success = TRUE;
 
605
  GimpImage *gimage;
 
606
  GimpParasite *parasite;
 
607
 
 
608
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
 
609
  if (! GIMP_IS_IMAGE (gimage))
 
610
    success = FALSE;
 
611
 
 
612
  parasite = (GimpParasite *) args[1].value.pdb_pointer;
 
613
  if (parasite == NULL || parasite->name == NULL || !g_utf8_validate (parasite->name, -1, NULL))
 
614
    success = FALSE;
 
615
 
 
616
  if (success)
 
617
    gimp_image_parasite_attach (gimage, parasite);
 
618
 
 
619
  return procedural_db_return_args (&image_parasite_attach_proc, success);
 
620
}
 
621
 
 
622
static ProcArg image_parasite_attach_inargs[] =
 
623
{
 
624
  {
 
625
    GIMP_PDB_IMAGE,
 
626
    "image",
 
627
    "The image"
 
628
  },
 
629
  {
 
630
    GIMP_PDB_PARASITE,
 
631
    "parasite",
 
632
    "The parasite to attach to an image"
 
633
  }
 
634
};
 
635
 
 
636
static ProcRecord image_parasite_attach_proc =
 
637
{
 
638
  "gimp_image_parasite_attach",
 
639
  "Add a parasite to an image.",
 
640
  "This procedure attaches a parasite to an image. It has no return values.",
 
641
  "Jay Cox",
 
642
  "Jay Cox",
 
643
  "1998",
 
644
  NULL,
 
645
  GIMP_INTERNAL,
 
646
  2,
 
647
  image_parasite_attach_inargs,
 
648
  0,
 
649
  NULL,
 
650
  { { image_parasite_attach_invoker } }
 
651
};
 
652
 
 
653
static Argument *
 
654
image_parasite_detach_invoker (Gimp         *gimp,
 
655
                               GimpContext  *context,
 
656
                               GimpProgress *progress,
 
657
                               Argument     *args)
 
658
{
 
659
  gboolean success = TRUE;
 
660
  GimpImage *gimage;
 
661
  gchar *name;
 
662
 
 
663
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
 
664
  if (! GIMP_IS_IMAGE (gimage))
 
665
    success = FALSE;
 
666
 
 
667
  name = (gchar *) args[1].value.pdb_pointer;
 
668
  if (name == NULL || !g_utf8_validate (name, -1, NULL))
 
669
    success = FALSE;
 
670
 
 
671
  if (success)
 
672
    gimp_image_parasite_detach (gimage, name);
 
673
 
 
674
  return procedural_db_return_args (&image_parasite_detach_proc, success);
 
675
}
 
676
 
 
677
static ProcArg image_parasite_detach_inargs[] =
 
678
{
 
679
  {
 
680
    GIMP_PDB_IMAGE,
 
681
    "image",
 
682
    "The image"
 
683
  },
 
684
  {
 
685
    GIMP_PDB_STRING,
 
686
    "name",
 
687
    "The name of the parasite to detach from an image."
 
688
  }
 
689
};
 
690
 
 
691
static ProcRecord image_parasite_detach_proc =
 
692
{
 
693
  "gimp_image_parasite_detach",
 
694
  "Removes a parasite from an image.",
 
695
  "This procedure detaches a parasite from an image. It has no return values.",
 
696
  "Jay Cox",
 
697
  "Jay Cox",
 
698
  "1998",
 
699
  NULL,
 
700
  GIMP_INTERNAL,
 
701
  2,
 
702
  image_parasite_detach_inargs,
 
703
  0,
 
704
  NULL,
 
705
  { { image_parasite_detach_invoker } }
 
706
};
 
707
 
 
708
static Argument *
 
709
image_parasite_list_invoker (Gimp         *gimp,
 
710
                             GimpContext  *context,
 
711
                             GimpProgress *progress,
 
712
                             Argument     *args)
 
713
{
 
714
  gboolean success = TRUE;
 
715
  Argument *return_args;
 
716
  GimpImage *gimage;
 
717
  gint32 num_parasites;
 
718
  gchar **parasites = NULL;
 
719
 
 
720
  gimage = gimp_image_get_by_ID (gimp, args[0].value.pdb_int);
 
721
  if (! GIMP_IS_IMAGE (gimage))
 
722
    success = FALSE;
 
723
 
 
724
  if (success)
 
725
    parasites = gimp_image_parasite_list (gimage, &num_parasites);
 
726
 
 
727
  return_args = procedural_db_return_args (&image_parasite_list_proc, success);
 
728
 
 
729
  if (success)
 
730
    {
 
731
      return_args[1].value.pdb_int = num_parasites;
 
732
      return_args[2].value.pdb_pointer = parasites;
 
733
    }
 
734
 
 
735
  return return_args;
 
736
}
 
737
 
 
738
static ProcArg image_parasite_list_inargs[] =
 
739
{
 
740
  {
 
741
    GIMP_PDB_IMAGE,
 
742
    "image",
 
743
    "The image"
 
744
  }
 
745
};
 
746
 
 
747
static ProcArg image_parasite_list_outargs[] =
 
748
{
 
749
  {
 
750
    GIMP_PDB_INT32,
 
751
    "num_parasites",
 
752
    "The number of attached parasites"
 
753
  },
 
754
  {
 
755
    GIMP_PDB_STRINGARRAY,
 
756
    "parasites",
 
757
    "The names of currently attached parasites"
 
758
  }
 
759
};
 
760
 
 
761
static ProcRecord image_parasite_list_proc =
 
762
{
 
763
  "gimp_image_parasite_list",
 
764
  "List all parasites.",
 
765
  "Returns a list of all currently attached parasites.",
 
766
  "Marc Lehmann",
 
767
  "Marc Lehmann",
 
768
  "1999",
 
769
  NULL,
 
770
  GIMP_INTERNAL,
 
771
  1,
 
772
  image_parasite_list_inargs,
 
773
  2,
 
774
  image_parasite_list_outargs,
 
775
  { { image_parasite_list_invoker } }
 
776
};