File: gimplinklayer_pdb.c

package info (click to toggle)
gimp 3.2.0~RC2-3.3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 220,684 kB
  • sloc: ansic: 866,773; lisp: 10,855; python: 10,511; cpp: 7,330; perl: 4,469; sh: 1,439; xml: 965; yacc: 609; lex: 348; javascript: 150; makefile: 42
file content (205 lines) | stat: -rw-r--r-- 6,018 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
/* LIBGIMP - The GIMP Library
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
 *
 * gimplinklayer_pdb.c
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
 * 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
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

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

#include "config.h"

#include "stamp-pdbgen.h"

#include "gimp.h"


/**
 * SECTION: gimplinklayer
 * @title: gimplinklayer
 * @short_description: Functions for querying and manipulating link layers.
 *
 * Functions for querying and manipulating link layers.
 **/


/**
 * gimp_link_layer_new:
 * @image: The image.
 * @file: The file this link layer will monitor.
 *
 * Create a new link layer.
 *
 * This procedure creates a link layer monitoring the specified @file.
 *
 * The new layer still needs to be added to the image as this is not
 * automatic. Add the new layer with the [method@Image.insert_layer]
 * method.
 *
 * The arguments are kept as simple as necessary for the basic case.
 * All link attributes, however, can be modified with the appropriate
 * `gimp_link_layer_set_*()` procedures.
 *
 * Returns: (transfer none):
 *          The new link layer. The object belongs to libgimp and you should not free it.
 *
 * Since: 3.2
 **/
GimpLinkLayer *
gimp_link_layer_new (GimpImage *image,
                     GFile     *file)
{
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GimpLinkLayer *layer = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_IMAGE, image,
                                          G_TYPE_FILE, file,
                                          G_TYPE_NONE);

  return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
                                               "gimp-link-layer-new",
                                               args);
  gimp_value_array_unref (args);

  if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
    layer = GIMP_VALUES_GET_LINK_LAYER (return_vals, 1);

  gimp_value_array_unref (return_vals);

  return layer;
}

/**
 * gimp_link_layer_get_file:
 * @layer: The link layer.
 *
 * Get the monitored file.
 *
 * This procedure returns the file which is being monitored.
 *
 * Returns: (transfer full): The monitored file.
 *
 * Since: 3.2
 **/
GFile *
gimp_link_layer_get_file (GimpLinkLayer *layer)
{
  GimpValueArray *args;
  GimpValueArray *return_vals;
  GFile *file = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LINK_LAYER, layer,
                                          G_TYPE_NONE);

  return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
                                               "gimp-link-layer-get-file",
                                               args);
  gimp_value_array_unref (args);

  if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
    file = GIMP_VALUES_DUP_FILE (return_vals, 1);

  gimp_value_array_unref (return_vals);

  return file;
}

/**
 * gimp_link_layer_set_file:
 * @layer: The link layer.
 * @file: The file to monitor.
 *
 * Set the monitored file.
 *
 * This procedure sets the file to be monitored. It may change the
 * layer's render.
 *
 * Returns: TRUE on success.
 *
 * Since: 3.2
 **/
gboolean
gimp_link_layer_set_file (GimpLinkLayer *layer,
                          GFile         *file)
{
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gboolean success = TRUE;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LINK_LAYER, layer,
                                          G_TYPE_FILE, file,
                                          G_TYPE_NONE);

  return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
                                               "gimp-link-layer-set-file",
                                               args);
  gimp_value_array_unref (args);

  success = GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS;

  gimp_value_array_unref (return_vals);

  return success;
}

/**
 * gimp_link_layer_get_mime_type:
 * @layer: The link layer.
 *
 * Get the mime type of the monitored file.
 *
 * This procedure returns the mime type of the file which is being
 * monitored by @layer.
 *
 * Note that this will be the real mime type, corresponding to our
 * format support, as returned by the [class@Gimp.LoadProcedure] which
 * actually performs the external image file import.
 *
 * This function may also return %NULL in case of error (for instance
 * if the external file doesn't exist anymore).
 *
 * Returns: (transfer full): The mime type of the monitored file.
 *          The returned value must be freed with g_free().
 *
 * Since: 3.2
 **/
gchar *
gimp_link_layer_get_mime_type (GimpLinkLayer *layer)
{
  GimpValueArray *args;
  GimpValueArray *return_vals;
  gchar *mimetype = NULL;

  args = gimp_value_array_new_from_types (NULL,
                                          GIMP_TYPE_LINK_LAYER, layer,
                                          G_TYPE_NONE);

  return_vals = _gimp_pdb_run_procedure_array (gimp_get_pdb (),
                                               "gimp-link-layer-get-mime-type",
                                               args);
  gimp_value_array_unref (args);

  if (GIMP_VALUES_GET_ENUM (return_vals, 0) == GIMP_PDB_SUCCESS)
    mimetype = GIMP_VALUES_DUP_STRING (return_vals, 1);

  gimp_value_array_unref (return_vals);

  return mimetype;
}