app: s/sprintf/g_snprintf/ in xcf_save_image()
[gimp.git] / libgimp / gimpgradients_pdb.c
blob71f17b8e293ac4b90ab37e6c22436d70b0e6eff5
1 /* LIBGIMP - The GIMP Library
2 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
4 * gimpgradients_pdb.c
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 3 of the License, or (at your option) any later version.
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.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library. If not, see
18 * <https://www.gnu.org/licenses/>.
21 /* NOTE: This file is auto-generated by pdbgen.pl */
23 #include "config.h"
25 #include "gimp.h"
28 /**
29 * SECTION: gimpgradients
30 * @title: gimpgradients
31 * @short_description: Operations related to gradients.
33 * Operations related to gradients.
34 **/
37 /**
38 * gimp_gradients_refresh:
40 * Refresh current gradients. This function always succeeds.
42 * This procedure retrieves all gradients currently in the user's
43 * gradient path and updates the gradient dialogs accordingly.
45 * Returns: TRUE on success.
46 **/
47 gboolean
48 gimp_gradients_refresh (void)
50 GimpParam *return_vals;
51 gint nreturn_vals;
52 gboolean success = TRUE;
54 return_vals = gimp_run_procedure ("gimp-gradients-refresh",
55 &nreturn_vals,
56 GIMP_PDB_END);
58 success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;
60 gimp_destroy_params (return_vals, nreturn_vals);
62 return success;
65 /**
66 * gimp_gradients_get_list:
67 * @filter: An optional regular expression used to filter the list.
68 * @num_gradients: The number of loaded gradients.
70 * Retrieve the list of loaded gradients.
72 * This procedure returns a list of the gradients that are currently
73 * loaded. You can later use the gimp_context_set_gradient() function
74 * to set the active gradient.
76 * Returns: The list of gradient names. The returned value must be
77 * freed with g_strfreev().
78 **/
79 gchar **
80 gimp_gradients_get_list (const gchar *filter,
81 gint *num_gradients)
83 GimpParam *return_vals;
84 gint nreturn_vals;
85 gchar **gradient_list = NULL;
86 gint i;
88 return_vals = gimp_run_procedure ("gimp-gradients-get-list",
89 &nreturn_vals,
90 GIMP_PDB_STRING, filter,
91 GIMP_PDB_END);
93 *num_gradients = 0;
95 if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
97 *num_gradients = return_vals[1].data.d_int32;
98 if (*num_gradients > 0)
100 gradient_list = g_new0 (gchar *, *num_gradients + 1);
101 for (i = 0; i < *num_gradients; i++)
102 gradient_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
106 gimp_destroy_params (return_vals, nreturn_vals);
108 return gradient_list;