gimppatterns_pdb.c 3.1 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
 * SECTION: gimppatterns
30 31 32 33 34 35 36
 * @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
gboolean
gimp_patterns_refresh (void)
{
50 51
  GimpValueArray *args;
  GimpValueArray *return_vals;
52 53
  gboolean success = TRUE;

54
  args = gimp_value_array_new_from_types (G_TYPE_NONE);
55

56 57 58
  return_vals = gimp_run_procedure_with_array ("gimp-patterns-refresh",
                                               args);
  gimp_value_array_unref (args);
59

60 61 62
  success = g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);
63 64 65 66 67 68

  return success;
}

/**
 * gimp_patterns_get_list:
69
 * @filter: An optional regular expression used to filter the list.
70 71 72 73 74 75
 * @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
76
 * gimp_context_set_pattern().
77
 *
Mukund Sivaraman's avatar
Mukund Sivaraman committed
78 79
 * Returns: The list of pattern names. The returned value must be freed
 * with g_strfreev().
80
 **/
81
gchar **
82
gimp_patterns_get_list (const gchar *filter,
83
                        gint        *num_patterns)
84
{
85 86
  GimpValueArray *args;
  GimpValueArray *return_vals;
87 88
  gchar **pattern_list = NULL;

89 90 91 92 93 94 95
  args = gimp_value_array_new_from_types (G_TYPE_STRING,
                                          G_TYPE_NONE);
  g_value_set_string (gimp_value_array_index (args, 0), filter);

  return_vals = gimp_run_procedure_with_array ("gimp-patterns-get-list",
                                               args);
  gimp_value_array_unref (args);
96 97 98

  *num_patterns = 0;

99
  if (g_value_get_enum (gimp_value_array_index (return_vals, 0)) == GIMP_PDB_SUCCESS)
100
    {
101 102
      *num_patterns = g_value_get_int (gimp_value_array_index (return_vals, 1));
      pattern_list = gimp_value_dup_string_array (gimp_value_array_index (return_vals, 2));
103 104
    }

105
  gimp_value_array_unref (return_vals);
106 107 108

  return pattern_list;
}