~ubuntu-branches/ubuntu/hoary/gimp/hoary

« back to all changes in this revision

Viewing changes to libgimp/gimpprogress_pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-04-04 14:51:23 UTC
  • Revision ID: james.westby@ubuntu.com-20050404145123-9py049eeelfymur8
Tags: upstream-2.2.2
ImportĀ upstreamĀ versionĀ 2.2.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* LIBGIMP - The GIMP Library
 
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 
3
 *
 
4
 * gimpprogress_pdb.c
 
5
 *
 
6
 * This library is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public
 
8
 * License as published by the Free Software Foundation; either
 
9
 * version 2 of the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library; if not, write to the
 
18
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
19
 * Boston, MA 02111-1307, USA.
 
20
 */
 
21
 
 
22
/* NOTE: This file is autogenerated by pdbgen.pl */
 
23
 
 
24
#include "config.h"
 
25
 
 
26
#include "gimp.h"
 
27
 
 
28
/**
 
29
 * gimp_progress_init:
 
30
 * @message: Message to use in the progress dialog.
 
31
 
 
32
 *
 
33
 * Initializes the progress bar for the current plug-in.
 
34
 *
 
35
 * Initializes the progress bar for the current plug-in. It is only
 
36
 * valid to call this procedure from a plug-in.
 
37
 *
 
38
 * Returns: TRUE on success.
 
39
 */
 
40
gboolean
 
41
gimp_progress_init (const gchar *message)
 
42
{
 
43
  GimpParam *return_vals;
 
44
  gint nreturn_vals;
 
45
  gboolean success = TRUE;
 
46
 
 
47
  return_vals = gimp_run_procedure ("gimp_progress_init",
 
48
                                    &nreturn_vals,
 
49
                                    GIMP_PDB_STRING, message,
 
50
                                    GIMP_PDB_INT32, gimp_default_display (),
 
51
                                    GIMP_PDB_END);
 
52
 
 
53
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
54
 
 
55
  gimp_destroy_params (return_vals, nreturn_vals);
 
56
 
 
57
  return success;
 
58
}
 
59
 
 
60
/**
 
61
 * gimp_progress_update:
 
62
 * @percentage: Percentage of progress completed which must be between 0.0 and 1.0.
 
63
 *
 
64
 * Updates the progress bar for the current plug-in.
 
65
 *
 
66
 * Updates the progress bar for the current plug-in. It is only valid
 
67
 * to call this procedure from a plug-in.
 
68
 *
 
69
 * Returns: TRUE on success.
 
70
 */
 
71
gboolean
 
72
gimp_progress_update (gdouble percentage)
 
73
{
 
74
  GimpParam *return_vals;
 
75
  gint nreturn_vals;
 
76
  gboolean success = TRUE;
 
77
 
 
78
  return_vals = gimp_run_procedure ("gimp_progress_update",
 
79
                                    &nreturn_vals,
 
80
                                    GIMP_PDB_FLOAT, percentage,
 
81
                                    GIMP_PDB_END);
 
82
 
 
83
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
84
 
 
85
  gimp_destroy_params (return_vals, nreturn_vals);
 
86
 
 
87
  return success;
 
88
}
 
89
 
 
90
/**
 
91
 * _gimp_progress_install:
 
92
 * @progress_callback: The callback PDB proc to call.
 
93
 *
 
94
 * Installs a progress callback for the current plug-in.
 
95
 *
 
96
 * This function installs a temporary PDB procedure which will handle
 
97
 * all progress calls made by this plug-in and any procedure it calls.
 
98
 * Calling this function multiple times simply replaces the old
 
99
 * progress callbacks.
 
100
 *
 
101
 * Returns: TRUE on success.
 
102
 *
 
103
 * Since: GIMP 2.2
 
104
 */
 
105
gboolean
 
106
_gimp_progress_install (const gchar *progress_callback)
 
107
{
 
108
  GimpParam *return_vals;
 
109
  gint nreturn_vals;
 
110
  gboolean success = TRUE;
 
111
 
 
112
  return_vals = gimp_run_procedure ("gimp_progress_install",
 
113
                                    &nreturn_vals,
 
114
                                    GIMP_PDB_STRING, progress_callback,
 
115
                                    GIMP_PDB_END);
 
116
 
 
117
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
118
 
 
119
  gimp_destroy_params (return_vals, nreturn_vals);
 
120
 
 
121
  return success;
 
122
}
 
123
 
 
124
/**
 
125
 * _gimp_progress_uninstall:
 
126
 * @progress_callback: The name of the callback registered for this progress.
 
127
 *
 
128
 * Uninstalls the progress callback for the current plug-in.
 
129
 *
 
130
 * This function uninstalls any progress callback installed with
 
131
 * gimp_progress_install() before.
 
132
 *
 
133
 * Returns: TRUE on success.
 
134
 *
 
135
 * Since: GIMP 2.2
 
136
 */
 
137
gboolean
 
138
_gimp_progress_uninstall (const gchar *progress_callback)
 
139
{
 
140
  GimpParam *return_vals;
 
141
  gint nreturn_vals;
 
142
  gboolean success = TRUE;
 
143
 
 
144
  return_vals = gimp_run_procedure ("gimp_progress_uninstall",
 
145
                                    &nreturn_vals,
 
146
                                    GIMP_PDB_STRING, progress_callback,
 
147
                                    GIMP_PDB_END);
 
148
 
 
149
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
150
 
 
151
  gimp_destroy_params (return_vals, nreturn_vals);
 
152
 
 
153
  return success;
 
154
}
 
155
 
 
156
/**
 
157
 * gimp_progress_cancel:
 
158
 * @progress_callback: The name of the callback registered for this progress.
 
159
 *
 
160
 * Cancels a running progress.
 
161
 *
 
162
 * This function cancels the currently running progress.
 
163
 *
 
164
 * Returns: TRUE on success.
 
165
 *
 
166
 * Since: GIMP 2.2
 
167
 */
 
168
gboolean
 
169
gimp_progress_cancel (const gchar *progress_callback)
 
170
{
 
171
  GimpParam *return_vals;
 
172
  gint nreturn_vals;
 
173
  gboolean success = TRUE;
 
174
 
 
175
  return_vals = gimp_run_procedure ("gimp_progress_cancel",
 
176
                                    &nreturn_vals,
 
177
                                    GIMP_PDB_STRING, progress_callback,
 
178
                                    GIMP_PDB_END);
 
179
 
 
180
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
 
181
 
 
182
  gimp_destroy_params (return_vals, nreturn_vals);
 
183
 
 
184
  return success;
 
185
}