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

« back to all changes in this revision

Viewing changes to app/pdb/progress_cmds.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-05-02 16:33:03 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070502163303-bvzhjzbpw8qglc4y
Tags: 2.3.16-1ubuntu1
* Resynchronized with Debian, remaining Ubuntu changes:
  - debian/rules: i18n magic.
* debian/control.in:
  - Maintainer: Ubuntu Core Developers <ubuntu-devel@lists.ubuntu.com>
* debian/patches/02_help-message.patch,
  debian/patches/03_gimp.desktop.in.in.patch,
  debian/patches/10_dont_show_wizard.patch: updated.
* debian/patches/04_composite-signedness.patch,
  debian/patches/05_add-letter-spacing.patch: dropped, used upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* The GIMP -- an image manipulation program
 
1
/* GIMP - The GNU Image Manipulation Program
2
2
 * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
3
3
 *
4
4
 * This program is free software; you can redistribute it and/or modify
16
16
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
17
 */
18
18
 
19
 
/* NOTE: This file is autogenerated by pdbgen.pl. */
 
19
/* NOTE: This file is auto-generated by pdbgen.pl. */
20
20
 
21
21
#include "config.h"
22
22
 
24
24
#include <glib-object.h>
25
25
 
26
26
#include "pdb-types.h"
27
 
#include "procedural_db.h"
 
27
#include "gimppdb.h"
 
28
#include "gimpprocedure.h"
 
29
#include "core/gimpparamspecs.h"
28
30
 
29
31
#include "core/gimp.h"
30
 
#include "plug-in/plug-in-progress.h"
31
 
#include "plug-in/plug-in.h"
32
 
 
33
 
static ProcRecord progress_init_proc;
34
 
static ProcRecord progress_update_proc;
35
 
static ProcRecord progress_install_proc;
36
 
static ProcRecord progress_uninstall_proc;
37
 
static ProcRecord progress_cancel_proc;
 
32
#include "plug-in/gimpplugin-progress.h"
 
33
#include "plug-in/gimpplugin.h"
 
34
#include "plug-in/gimppluginmanager.h"
 
35
 
 
36
#include "internal_procs.h"
 
37
 
 
38
 
 
39
static GValueArray *
 
40
progress_init_invoker (GimpProcedure     *procedure,
 
41
                       Gimp              *gimp,
 
42
                       GimpContext       *context,
 
43
                       GimpProgress      *progress,
 
44
                       const GValueArray *args)
 
45
{
 
46
  gboolean success = TRUE;
 
47
  const gchar *message;
 
48
  GimpObject *gdisplay;
 
49
 
 
50
  message = g_value_get_string (&args->values[0]);
 
51
  gdisplay = gimp_value_get_display (&args->values[1], gimp);
 
52
 
 
53
  if (success)
 
54
    {
 
55
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
56
 
 
57
      if (plug_in && plug_in->open)
 
58
        {
 
59
          if (! gimp->no_interface)
 
60
            gimp_plug_in_progress_start (plug_in, message, gdisplay);
 
61
        }
 
62
      else
 
63
        success = FALSE;
 
64
    }
 
65
 
 
66
  return gimp_procedure_get_return_values (procedure, success);
 
67
}
 
68
 
 
69
static GValueArray *
 
70
progress_update_invoker (GimpProcedure     *procedure,
 
71
                         Gimp              *gimp,
 
72
                         GimpContext       *context,
 
73
                         GimpProgress      *progress,
 
74
                         const GValueArray *args)
 
75
{
 
76
  gboolean success = TRUE;
 
77
  gdouble percentage;
 
78
 
 
79
  percentage = g_value_get_double (&args->values[0]);
 
80
 
 
81
  if (success)
 
82
    {
 
83
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
84
 
 
85
      if (plug_in && plug_in->open)
 
86
        {
 
87
          if (! gimp->no_interface)
 
88
            gimp_plug_in_progress_set_value (plug_in, percentage);
 
89
        }
 
90
      else
 
91
        success = FALSE;
 
92
    }
 
93
 
 
94
  return gimp_procedure_get_return_values (procedure, success);
 
95
}
 
96
 
 
97
static GValueArray *
 
98
progress_pulse_invoker (GimpProcedure     *procedure,
 
99
                        Gimp              *gimp,
 
100
                        GimpContext       *context,
 
101
                        GimpProgress      *progress,
 
102
                        const GValueArray *args)
 
103
{
 
104
  gboolean success = TRUE;
 
105
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
106
 
 
107
  if (plug_in && plug_in->open)
 
108
    {
 
109
      if (! gimp->no_interface)
 
110
        gimp_plug_in_progress_pulse (plug_in);
 
111
    }
 
112
  else
 
113
    success = FALSE;
 
114
 
 
115
  return gimp_procedure_get_return_values (procedure, success);
 
116
}
 
117
 
 
118
static GValueArray *
 
119
progress_set_text_invoker (GimpProcedure     *procedure,
 
120
                           Gimp              *gimp,
 
121
                           GimpContext       *context,
 
122
                           GimpProgress      *progress,
 
123
                           const GValueArray *args)
 
124
{
 
125
  gboolean success = TRUE;
 
126
  const gchar *message;
 
127
 
 
128
  message = g_value_get_string (&args->values[0]);
 
129
 
 
130
  if (success)
 
131
    {
 
132
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
133
 
 
134
      if (plug_in && plug_in->open)
 
135
        {
 
136
          if (! gimp->no_interface)
 
137
            gimp_plug_in_progress_set_text (plug_in, message);
 
138
        }
 
139
      else
 
140
        success = FALSE;
 
141
    }
 
142
 
 
143
  return gimp_procedure_get_return_values (procedure, success);
 
144
}
 
145
 
 
146
static GValueArray *
 
147
progress_get_window_handle_invoker (GimpProcedure     *procedure,
 
148
                                    Gimp              *gimp,
 
149
                                    GimpContext       *context,
 
150
                                    GimpProgress      *progress,
 
151
                                    const GValueArray *args)
 
152
{
 
153
  gboolean success = TRUE;
 
154
  GValueArray *return_vals;
 
155
  gint32 window = 0;
 
156
 
 
157
  GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
158
 
 
159
  if (plug_in && plug_in->open)
 
160
    {
 
161
      if (! gimp->no_interface)
 
162
        window = gimp_plug_in_progress_get_window (plug_in);
 
163
    }
 
164
  else
 
165
    success = FALSE;
 
166
 
 
167
  return_vals = gimp_procedure_get_return_values (procedure, success);
 
168
 
 
169
  if (success)
 
170
    g_value_set_int (&return_vals->values[1], window);
 
171
 
 
172
  return return_vals;
 
173
}
 
174
 
 
175
static GValueArray *
 
176
progress_install_invoker (GimpProcedure     *procedure,
 
177
                          Gimp              *gimp,
 
178
                          GimpContext       *context,
 
179
                          GimpProgress      *progress,
 
180
                          const GValueArray *args)
 
181
{
 
182
  gboolean success = TRUE;
 
183
  const gchar *progress_callback;
 
184
 
 
185
  progress_callback = g_value_get_string (&args->values[0]);
 
186
 
 
187
  if (success)
 
188
    {
 
189
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
190
 
 
191
      if (plug_in && plug_in->open)
 
192
        success = gimp_plug_in_progress_install (plug_in, progress_callback);
 
193
      else
 
194
        success = FALSE;
 
195
    }
 
196
 
 
197
  return gimp_procedure_get_return_values (procedure, success);
 
198
}
 
199
 
 
200
static GValueArray *
 
201
progress_uninstall_invoker (GimpProcedure     *procedure,
 
202
                            Gimp              *gimp,
 
203
                            GimpContext       *context,
 
204
                            GimpProgress      *progress,
 
205
                            const GValueArray *args)
 
206
{
 
207
  gboolean success = TRUE;
 
208
  const gchar *progress_callback;
 
209
 
 
210
  progress_callback = g_value_get_string (&args->values[0]);
 
211
 
 
212
  if (success)
 
213
    {
 
214
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
215
 
 
216
      if (plug_in && plug_in->open)
 
217
        success = gimp_plug_in_progress_uninstall (plug_in, progress_callback);
 
218
      else
 
219
        success = FALSE;
 
220
    }
 
221
 
 
222
  return gimp_procedure_get_return_values (procedure, success);
 
223
}
 
224
 
 
225
static GValueArray *
 
226
progress_cancel_invoker (GimpProcedure     *procedure,
 
227
                         Gimp              *gimp,
 
228
                         GimpContext       *context,
 
229
                         GimpProgress      *progress,
 
230
                         const GValueArray *args)
 
231
{
 
232
  gboolean success = TRUE;
 
233
  const gchar *progress_callback;
 
234
 
 
235
  progress_callback = g_value_get_string (&args->values[0]);
 
236
 
 
237
  if (success)
 
238
    {
 
239
      GimpPlugIn *plug_in = gimp->plug_in_manager->current_plug_in;
 
240
 
 
241
      if (plug_in && plug_in->open)
 
242
        success = gimp_plug_in_progress_cancel (plug_in, progress_callback);
 
243
      else
 
244
        success = FALSE;
 
245
    }
 
246
 
 
247
  return gimp_procedure_get_return_values (procedure, success);
 
248
}
38
249
 
39
250
void
40
 
register_progress_procs (Gimp *gimp)
41
 
{
42
 
  procedural_db_register (gimp, &progress_init_proc);
43
 
  procedural_db_register (gimp, &progress_update_proc);
44
 
  procedural_db_register (gimp, &progress_install_proc);
45
 
  procedural_db_register (gimp, &progress_uninstall_proc);
46
 
  procedural_db_register (gimp, &progress_cancel_proc);
47
 
}
48
 
 
49
 
static Argument *
50
 
progress_init_invoker (Gimp         *gimp,
51
 
                       GimpContext  *context,
52
 
                       GimpProgress *progress,
53
 
                       Argument     *args)
54
 
{
55
 
  gboolean success = TRUE;
56
 
  gchar *message;
57
 
  gint32 gdisplay;
58
 
 
59
 
  message = (gchar *) args[0].value.pdb_pointer;
60
 
  if (message && !g_utf8_validate (message, -1, NULL))
61
 
    success = FALSE;
62
 
 
63
 
  gdisplay = args[1].value.pdb_int;
64
 
 
65
 
  if (success)
66
 
    {
67
 
      if (gimp->current_plug_in && gimp->current_plug_in->open)
68
 
        {
69
 
          if (! gimp->no_interface)
70
 
            plug_in_progress_start (gimp->current_plug_in, message, gdisplay);
71
 
        }
72
 
      else
73
 
        success = FALSE;
74
 
    }
75
 
 
76
 
  return procedural_db_return_args (&progress_init_proc, success);
77
 
}
78
 
 
79
 
static ProcArg progress_init_inargs[] =
80
 
{
81
 
  {
82
 
    GIMP_PDB_STRING,
83
 
    "message",
84
 
    "Message to use in the progress dialog"
85
 
  },
86
 
  {
87
 
    GIMP_PDB_INT32,
88
 
    "gdisplay",
89
 
    "GimpDisplay to update progressbar in, or -1 for a seperate window"
90
 
  }
91
 
};
92
 
 
93
 
static ProcRecord progress_init_proc =
94
 
{
95
 
  "gimp_progress_init",
96
 
  "Initializes the progress bar for the current plug-in.",
97
 
  "Initializes the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in.",
98
 
  "Spencer Kimball & Peter Mattis",
99
 
  "Spencer Kimball & Peter Mattis",
100
 
  "1995-1996",
101
 
  NULL,
102
 
  GIMP_INTERNAL,
103
 
  2,
104
 
  progress_init_inargs,
105
 
  0,
106
 
  NULL,
107
 
  { { progress_init_invoker } }
108
 
};
109
 
 
110
 
static Argument *
111
 
progress_update_invoker (Gimp         *gimp,
112
 
                         GimpContext  *context,
113
 
                         GimpProgress *progress,
114
 
                         Argument     *args)
115
 
{
116
 
  gboolean success = TRUE;
117
 
  gdouble percentage;
118
 
 
119
 
  percentage = args[0].value.pdb_float;
120
 
 
121
 
  if (gimp->current_plug_in && gimp->current_plug_in->open)
122
 
    {
123
 
      if (! gimp->no_interface)
124
 
        plug_in_progress_update (gimp->current_plug_in, percentage);
125
 
    }
126
 
  else
127
 
    success = FALSE;
128
 
 
129
 
  return procedural_db_return_args (&progress_update_proc, success);
130
 
}
131
 
 
132
 
static ProcArg progress_update_inargs[] =
133
 
{
134
 
  {
135
 
    GIMP_PDB_FLOAT,
136
 
    "percentage",
137
 
    "Percentage of progress completed which must be between 0.0 and 1.0"
138
 
  }
139
 
};
140
 
 
141
 
static ProcRecord progress_update_proc =
142
 
{
143
 
  "gimp_progress_update",
144
 
  "Updates the progress bar for the current plug-in.",
145
 
  "Updates the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in.",
146
 
  "Spencer Kimball & Peter Mattis",
147
 
  "Spencer Kimball & Peter Mattis",
148
 
  "1995-1996",
149
 
  NULL,
150
 
  GIMP_INTERNAL,
151
 
  1,
152
 
  progress_update_inargs,
153
 
  0,
154
 
  NULL,
155
 
  { { progress_update_invoker } }
156
 
};
157
 
 
158
 
static Argument *
159
 
progress_install_invoker (Gimp         *gimp,
160
 
                          GimpContext  *context,
161
 
                          GimpProgress *progress,
162
 
                          Argument     *args)
163
 
{
164
 
  gboolean success = TRUE;
165
 
  gchar *progress_callback;
166
 
 
167
 
  progress_callback = (gchar *) args[0].value.pdb_pointer;
168
 
  if (progress_callback == NULL || !g_utf8_validate (progress_callback, -1, NULL))
169
 
    success = FALSE;
170
 
 
171
 
  if (success)
172
 
    {
173
 
      if (gimp->current_plug_in && gimp->current_plug_in->open)
174
 
        success = plug_in_progress_install (gimp->current_plug_in,
175
 
                                            progress_callback);
176
 
      else
177
 
        success = FALSE;
178
 
    }
179
 
 
180
 
  return procedural_db_return_args (&progress_install_proc, success);
181
 
}
182
 
 
183
 
static ProcArg progress_install_inargs[] =
184
 
{
185
 
  {
186
 
    GIMP_PDB_STRING,
187
 
    "progress_callback",
188
 
    "The callback PDB proc to call"
189
 
  }
190
 
};
191
 
 
192
 
static ProcRecord progress_install_proc =
193
 
{
194
 
  "gimp_progress_install",
195
 
  "Installs a progress callback for the current plug-in.",
196
 
  "This function installs a temporary PDB procedure which will handle all progress calls made by this plug-in and any procedure it calls. Calling this function multiple times simply replaces the old progress callbacks.",
197
 
  "Michael Natterer <mitch@gimp.org>",
198
 
  "Michael Natterer",
199
 
  "2004",
200
 
  NULL,
201
 
  GIMP_INTERNAL,
202
 
  1,
203
 
  progress_install_inargs,
204
 
  0,
205
 
  NULL,
206
 
  { { progress_install_invoker } }
207
 
};
208
 
 
209
 
static Argument *
210
 
progress_uninstall_invoker (Gimp         *gimp,
211
 
                            GimpContext  *context,
212
 
                            GimpProgress *progress,
213
 
                            Argument     *args)
214
 
{
215
 
  gboolean success = TRUE;
216
 
  gchar *progress_callback;
217
 
 
218
 
  progress_callback = (gchar *) args[0].value.pdb_pointer;
219
 
  if (progress_callback == NULL || !g_utf8_validate (progress_callback, -1, NULL))
220
 
    success = FALSE;
221
 
 
222
 
  if (success)
223
 
    {
224
 
      if (gimp->current_plug_in && gimp->current_plug_in->open)
225
 
        success = plug_in_progress_uninstall (gimp->current_plug_in,
226
 
                                              progress_callback);
227
 
      else
228
 
        success = FALSE;
229
 
    }
230
 
 
231
 
  return procedural_db_return_args (&progress_uninstall_proc, success);
232
 
}
233
 
 
234
 
static ProcArg progress_uninstall_inargs[] =
235
 
{
236
 
  {
237
 
    GIMP_PDB_STRING,
238
 
    "progress_callback",
239
 
    "The name of the callback registered for this progress"
240
 
  }
241
 
};
242
 
 
243
 
static ProcRecord progress_uninstall_proc =
244
 
{
245
 
  "gimp_progress_uninstall",
246
 
  "Uninstalls the progress callback for the current plug-in.",
247
 
  "This function uninstalls any progress callback installed with gimp_progress_install() before.",
248
 
  "Michael Natterer <mitch@gimp.org>",
249
 
  "Michael Natterer",
250
 
  "2004",
251
 
  NULL,
252
 
  GIMP_INTERNAL,
253
 
  1,
254
 
  progress_uninstall_inargs,
255
 
  0,
256
 
  NULL,
257
 
  { { progress_uninstall_invoker } }
258
 
};
259
 
 
260
 
static Argument *
261
 
progress_cancel_invoker (Gimp         *gimp,
262
 
                         GimpContext  *context,
263
 
                         GimpProgress *progress,
264
 
                         Argument     *args)
265
 
{
266
 
  gboolean success = TRUE;
267
 
  gchar *progress_callback;
268
 
 
269
 
  progress_callback = (gchar *) args[0].value.pdb_pointer;
270
 
  if (progress_callback == NULL || !g_utf8_validate (progress_callback, -1, NULL))
271
 
    success = FALSE;
272
 
 
273
 
  if (success)
274
 
    {
275
 
      if (gimp->current_plug_in && gimp->current_plug_in->open)
276
 
        success = plug_in_progress_cancel (gimp->current_plug_in,
277
 
                                           progress_callback);
278
 
      else
279
 
        success = FALSE;
280
 
    }
281
 
 
282
 
  return procedural_db_return_args (&progress_cancel_proc, success);
283
 
}
284
 
 
285
 
static ProcArg progress_cancel_inargs[] =
286
 
{
287
 
  {
288
 
    GIMP_PDB_STRING,
289
 
    "progress_callback",
290
 
    "The name of the callback registered for this progress"
291
 
  }
292
 
};
293
 
 
294
 
static ProcRecord progress_cancel_proc =
295
 
{
296
 
  "gimp_progress_cancel",
297
 
  "Cancels a running progress.",
298
 
  "This function cancels the currently running progress.",
299
 
  "Michael Natterer <mitch@gimp.org>",
300
 
  "Michael Natterer",
301
 
  "2004",
302
 
  NULL,
303
 
  GIMP_INTERNAL,
304
 
  1,
305
 
  progress_cancel_inargs,
306
 
  0,
307
 
  NULL,
308
 
  { { progress_cancel_invoker } }
309
 
};
 
251
register_progress_procs (GimpPDB *pdb)
 
252
{
 
253
  GimpProcedure *procedure;
 
254
 
 
255
  /*
 
256
   * gimp-progress-init
 
257
   */
 
258
  procedure = gimp_procedure_new (progress_init_invoker);
 
259
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-init");
 
260
  gimp_procedure_set_static_strings (procedure,
 
261
                                     "gimp-progress-init",
 
262
                                     "Initializes the progress bar for the current plug-in.",
 
263
                                     "Initializes the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in.",
 
264
                                     "Spencer Kimball & Peter Mattis",
 
265
                                     "Spencer Kimball & Peter Mattis",
 
266
                                     "1995-1996",
 
267
                                     NULL);
 
268
  gimp_procedure_add_argument (procedure,
 
269
                               gimp_param_spec_string ("message",
 
270
                                                       "message",
 
271
                                                       "Message to use in the progress dialog",
 
272
                                                       FALSE, TRUE,
 
273
                                                       NULL,
 
274
                                                       GIMP_PARAM_READWRITE));
 
275
  gimp_procedure_add_argument (procedure,
 
276
                               gimp_param_spec_display_id ("gdisplay",
 
277
                                                           "gdisplay",
 
278
                                                           "GimpDisplay to update progressbar in, or -1 for a seperate window",
 
279
                                                           pdb->gimp, TRUE,
 
280
                                                           GIMP_PARAM_READWRITE));
 
281
  gimp_pdb_register_procedure (pdb, procedure);
 
282
  g_object_unref (procedure);
 
283
 
 
284
  /*
 
285
   * gimp-progress-update
 
286
   */
 
287
  procedure = gimp_procedure_new (progress_update_invoker);
 
288
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-update");
 
289
  gimp_procedure_set_static_strings (procedure,
 
290
                                     "gimp-progress-update",
 
291
                                     "Updates the progress bar for the current plug-in.",
 
292
                                     "Updates the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in.",
 
293
                                     "Spencer Kimball & Peter Mattis",
 
294
                                     "Spencer Kimball & Peter Mattis",
 
295
                                     "1995-1996",
 
296
                                     NULL);
 
297
  gimp_procedure_add_argument (procedure,
 
298
                               g_param_spec_double ("percentage",
 
299
                                                    "percentage",
 
300
                                                    "Percentage of progress completed which must be between 0.0 and 1.0",
 
301
                                                    -G_MAXDOUBLE, G_MAXDOUBLE, 0,
 
302
                                                    GIMP_PARAM_READWRITE));
 
303
  gimp_pdb_register_procedure (pdb, procedure);
 
304
  g_object_unref (procedure);
 
305
 
 
306
  /*
 
307
   * gimp-progress-pulse
 
308
   */
 
309
  procedure = gimp_procedure_new (progress_pulse_invoker);
 
310
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-pulse");
 
311
  gimp_procedure_set_static_strings (procedure,
 
312
                                     "gimp-progress-pulse",
 
313
                                     "Pulses the progress bar for the current plug-in.",
 
314
                                     "Updates the progress bar for the current plug-in. It is only valid to call this procedure from a plug-in. Use this function instead of 'gimp-progress-update' if you cannot tell how much progress has been made. This usually causes the the progress bar to enter \"activity mode\", where a block bounces back and forth.",
 
315
                                     "Sven Neumann <sven@gimp.org>",
 
316
                                     "Sven Neumann",
 
317
                                     "2005",
 
318
                                     NULL);
 
319
  gimp_pdb_register_procedure (pdb, procedure);
 
320
  g_object_unref (procedure);
 
321
 
 
322
  /*
 
323
   * gimp-progress-set-text
 
324
   */
 
325
  procedure = gimp_procedure_new (progress_set_text_invoker);
 
326
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-set-text");
 
327
  gimp_procedure_set_static_strings (procedure,
 
328
                                     "gimp-progress-set-text",
 
329
                                     "Changes the text in the progress bar for the current plug-in.",
 
330
                                     "This function allows to change the text in the progress bar for the current plug-in. Unlike 'gimp-progress-init' it does not change the displayed value.",
 
331
                                     "Sven Neumann <sven@gimp.org>",
 
332
                                     "Sven Neumann",
 
333
                                     "2005",
 
334
                                     NULL);
 
335
  gimp_procedure_add_argument (procedure,
 
336
                               gimp_param_spec_string ("message",
 
337
                                                       "message",
 
338
                                                       "Message to use in the progress dialog",
 
339
                                                       FALSE, TRUE,
 
340
                                                       NULL,
 
341
                                                       GIMP_PARAM_READWRITE));
 
342
  gimp_pdb_register_procedure (pdb, procedure);
 
343
  g_object_unref (procedure);
 
344
 
 
345
  /*
 
346
   * gimp-progress-get-window-handle
 
347
   */
 
348
  procedure = gimp_procedure_new (progress_get_window_handle_invoker);
 
349
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-get-window-handle");
 
350
  gimp_procedure_set_static_strings (procedure,
 
351
                                     "gimp-progress-get-window-handle",
 
352
                                     "Returns the native window ID of the toplevel window this plug-in's progress is displayed in.",
 
353
                                     "This function returns the native window ID of the toplevel window this plug-in\'s progress is displayed in.",
 
354
                                     "Michael Natterer <mitch@gimp.org>",
 
355
                                     "Michael Natterer",
 
356
                                     "2004",
 
357
                                     NULL);
 
358
  gimp_procedure_add_return_value (procedure,
 
359
                                   gimp_param_spec_int32 ("window",
 
360
                                                          "window",
 
361
                                                          "The progress bar's toplevel window",
 
362
                                                          G_MININT32, G_MAXINT32, 0,
 
363
                                                          GIMP_PARAM_READWRITE));
 
364
  gimp_pdb_register_procedure (pdb, procedure);
 
365
  g_object_unref (procedure);
 
366
 
 
367
  /*
 
368
   * gimp-progress-install
 
369
   */
 
370
  procedure = gimp_procedure_new (progress_install_invoker);
 
371
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-install");
 
372
  gimp_procedure_set_static_strings (procedure,
 
373
                                     "gimp-progress-install",
 
374
                                     "Installs a progress callback for the current plug-in.",
 
375
                                     "This function installs a temporary PDB procedure which will handle all progress calls made by this plug-in and any procedure it calls. Calling this function multiple times simply replaces the old progress callbacks.",
 
376
                                     "Michael Natterer <mitch@gimp.org>",
 
377
                                     "Michael Natterer",
 
378
                                     "2004",
 
379
                                     NULL);
 
380
  gimp_procedure_add_argument (procedure,
 
381
                               gimp_param_spec_string ("progress-callback",
 
382
                                                       "progress callback",
 
383
                                                       "The callback PDB proc to call",
 
384
                                                       FALSE, FALSE,
 
385
                                                       NULL,
 
386
                                                       GIMP_PARAM_READWRITE));
 
387
  gimp_pdb_register_procedure (pdb, procedure);
 
388
  g_object_unref (procedure);
 
389
 
 
390
  /*
 
391
   * gimp-progress-uninstall
 
392
   */
 
393
  procedure = gimp_procedure_new (progress_uninstall_invoker);
 
394
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-uninstall");
 
395
  gimp_procedure_set_static_strings (procedure,
 
396
                                     "gimp-progress-uninstall",
 
397
                                     "Uninstalls the progress callback for the current plug-in.",
 
398
                                     "This function uninstalls any progress callback installed with 'gimp-progress-install' before.",
 
399
                                     "Michael Natterer <mitch@gimp.org>",
 
400
                                     "Michael Natterer",
 
401
                                     "2004",
 
402
                                     NULL);
 
403
  gimp_procedure_add_argument (procedure,
 
404
                               gimp_param_spec_string ("progress-callback",
 
405
                                                       "progress callback",
 
406
                                                       "The name of the callback registered for this progress",
 
407
                                                       FALSE, FALSE,
 
408
                                                       NULL,
 
409
                                                       GIMP_PARAM_READWRITE));
 
410
  gimp_pdb_register_procedure (pdb, procedure);
 
411
  g_object_unref (procedure);
 
412
 
 
413
  /*
 
414
   * gimp-progress-cancel
 
415
   */
 
416
  procedure = gimp_procedure_new (progress_cancel_invoker);
 
417
  gimp_object_set_static_name (GIMP_OBJECT (procedure), "gimp-progress-cancel");
 
418
  gimp_procedure_set_static_strings (procedure,
 
419
                                     "gimp-progress-cancel",
 
420
                                     "Cancels a running progress.",
 
421
                                     "This function cancels the currently running progress.",
 
422
                                     "Michael Natterer <mitch@gimp.org>",
 
423
                                     "Michael Natterer",
 
424
                                     "2004",
 
425
                                     NULL);
 
426
  gimp_procedure_add_argument (procedure,
 
427
                               gimp_param_spec_string ("progress-callback",
 
428
                                                       "progress callback",
 
429
                                                       "The name of the callback registered for this progress",
 
430
                                                       FALSE, FALSE,
 
431
                                                       NULL,
 
432
                                                       GIMP_PARAM_READWRITE));
 
433
  gimp_pdb_register_procedure (pdb, procedure);
 
434
  g_object_unref (procedure);
 
435
}