gimppatterns_pdb.c 3 KB
Newer Older
1
/* LIBGIMP - The GIMP Library
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3 4 5
 *
 * gimppatterns_pdb.c
 *
6
 * This library is free software: you can redistribute it and/or
7 8
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
9
 * version 3 of the License, or (at your option) any later version.
10 11 12 13 14 15 16
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * 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/>.
19 20
 */

21
/* NOTE: This file is auto-generated by pdbgen.pl */
22

Sven Neumann's avatar
Sven Neumann committed
23 24
#include "config.h"

25 26
#include "gimp.h"

27 28 29 30 31 32 33 34 35 36

/**
 * SECTION: gimppatterns
 * @title: gimppatterns
 * @short_description: Functions relating to patterns.
 *
 * Functions relating to patterns.
 **/


37 38 39
/**
 * gimp_patterns_refresh:
 *
40
 * Refresh current patterns. This function always succeeds.
41 42
 *
 * This procedure retrieves all patterns currently in the user's
43
 * pattern path and updates all pattern dialogs accordingly.
44 45
 *
 * Returns: TRUE on success.
46
 **/
47 48 49 50 51 52 53
gboolean
gimp_patterns_refresh (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gboolean success = TRUE;

54
  return_vals = gimp_run_procedure ("gimp-patterns-refresh",
55 56
                                    &nreturn_vals,
                                    GIMP_PDB_END);
57 58 59 60 61 62 63 64 65 66

  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  gimp_destroy_params (return_vals, nreturn_vals);

  return success;
}

/**
 * gimp_patterns_get_list:
67
 * @filter: An optional regular expression used to filter the list.
68 69 70 71 72 73
 * @num_patterns: The number of patterns in the pattern list.
 *
 * Retrieve a complete listing of the available patterns.
 *
 * This procedure returns a complete listing of available GIMP
 * patterns. Each name returned can be used as input to the
74
 * gimp_context_set_pattern().
75
 *
76 77
 * Returns: The list of pattern names. The returned value must be freed
 * with g_strfreev().
78
 **/
79
gchar **
80
gimp_patterns_get_list (const gchar *filter,
81
                        gint        *num_patterns)
82 83 84 85 86 87
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar **pattern_list = NULL;
  gint i;

88
  return_vals = gimp_run_procedure ("gimp-patterns-get-list",
89 90 91
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, filter,
                                    GIMP_PDB_END);
92 93 94 95 96 97

  *num_patterns = 0;

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    {
      *num_patterns = return_vals[1].data.d_int32;
98 99 100 101 102 103
      if (*num_patterns > 0)
        {
          pattern_list = g_new0 (gchar *, *num_patterns + 1);
          for (i = 0; i < *num_patterns; i++)
            pattern_list[i] = g_strdup (return_vals[2].data.d_stringarray[i]);
        }
104 105 106 107 108 109
    }

  gimp_destroy_params (return_vals, nreturn_vals);

  return pattern_list;
}