gimpgimprc_pdb.c 7.06 KB
Newer Older
1
/* LIBGIMP - The GIMP Library
2
 * Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * gimpgimprc_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 2 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, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

/* NOTE: This file is autogenerated by pdbgen.pl */

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

26 27
#include "gimp.h"

28 29 30 31 32 33 34 35 36 37 38 39
/**
 * gimp_gimprc_query:
 * @token: The token to query for.
 *
 * Queries the gimprc file parser for information on a specified token.
 *
 * This procedure is used to locate additional information contained in
 * the gimprc file considered extraneous to the operation of the GIMP.
 * Plug-ins that need configuration information can expect it will be
 * stored in the user gimprc file and can use this procedure to
 * retrieve it. This query procedure will return the value associated
 * with the specified token. This corresponds _only_ to entries with
40 41 42
 * the format: (<token> <value>). The value must be a
 * string. Entries not corresponding to this format will cause warnings
 * to be issued on gimprc parsing and will not be queryable.
43 44 45
 *
 * Returns: The value associated with the queried token.
 */
46
gchar *
47
gimp_gimprc_query (const gchar *token)
48
{
49
  GimpParam *return_vals;
50 51 52
  gint nreturn_vals;
  gchar *value = NULL;

53
  return_vals = gimp_run_procedure ("gimp-gimprc-query",
54 55 56
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, token,
                                    GIMP_PDB_END);
57

58
  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
59 60 61 62 63 64 65
    value = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return value;
}

66 67
/**
 * gimp_gimprc_set:
68
 * @token: The token to add or modify.
69 70 71 72 73 74 75
 * @value: The value to set the token to.
 *
 * Sets a gimprc token to a value and saves it in the gimprc.
 *
 * This procedure is used to add or change additional information in
 * the gimprc file that is considered extraneous to the operation of
 * the GIMP. Plug-ins that need configuration information can use this
76
 * function to store it, and gimp_gimprc_query() to retrieve it. This
77
 * will accept _only_ string values in UTF-8 encoding.
78 79 80
 *
 * Returns: TRUE on success.
 */
81
gboolean
82
gimp_gimprc_set (const gchar *token,
83
                 const gchar *value)
84
{
85
  GimpParam *return_vals;
86
  gint nreturn_vals;
87
  gboolean success = TRUE;
88

89
  return_vals = gimp_run_procedure ("gimp-gimprc-set",
90 91 92 93
                                    &nreturn_vals,
                                    GIMP_PDB_STRING, token,
                                    GIMP_PDB_STRING, value,
                                    GIMP_PDB_END);
94

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

97
  gimp_destroy_params (return_vals, nreturn_vals);
98 99

  return success;
100 101
}

102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
/**
 * gimp_get_default_comment:
 *
 * Get the default image comment as specified in the Preferences.
 *
 * Returns a copy of the default image comment.
 *
 * Returns: Default Image Comment.
 */
gchar *
gimp_get_default_comment (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *comment = NULL;

118
  return_vals = gimp_run_procedure ("gimp-get-default-comment",
119 120
                                    &nreturn_vals,
                                    GIMP_PDB_END);
121 122 123 124 125 126 127 128 129

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    comment = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return comment;
}

130 131 132 133 134 135 136 137
/**
 * gimp_get_monitor_resolution:
 * @xres: X resolution.
 * @yres: Y resolution.
 *
 * Get the monitor resolution as specified in the Preferences.
 *
 * Returns the resolution of the monitor in pixels/inch. This value is
138 139
 * taken from the Preferences (or the windowing system if this is set
 * in the Preferences) and there's no guarantee for the value to be
140 141 142 143
 * reasonable.
 *
 * Returns: TRUE on success.
 */
144
gboolean
145
gimp_get_monitor_resolution (gdouble *xres,
146
                             gdouble *yres)
147
{
148
  GimpParam *return_vals;
149
  gint nreturn_vals;
150
  gboolean success = TRUE;
151

152
  return_vals = gimp_run_procedure ("gimp-get-monitor-resolution",
153 154
                                    &nreturn_vals,
                                    GIMP_PDB_END);
155

156 157 158
  *xres = 0.0;
  *yres = 0.0;

159 160 161
  success = return_vals[0].data.d_status == GIMP_PDB_SUCCESS;

  if (success)
162 163 164 165 166 167
    {
      *xres = return_vals[1].data.d_float;
      *yres = return_vals[2].data.d_float;
    }

  gimp_destroy_params (return_vals, nreturn_vals);
168 169

  return success;
170
}
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187

/**
 * gimp_get_theme_dir:
 *
 * Get the directory of the current GUI theme.
 *
 * Returns a copy of the current GUI theme dir.
 *
 * Returns: The GUI theme dir.
 */
gchar *
gimp_get_theme_dir (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *theme_dir = NULL;

188
  return_vals = gimp_run_procedure ("gimp-get-theme-dir",
189 190
                                    &nreturn_vals,
                                    GIMP_PDB_END);
191 192 193 194 195 196 197 198

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    theme_dir = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return theme_dir;
}
199

200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
/**
 * _gimp_get_color_configuration:
 *
 * Get a serialized version of the color management configuration.
 *
 * Returns a string that can be deserialized into a GimpColorConfig
 * object representing the current color management configuration.
 *
 * Returns: Serialized color management configuration.
 *
 * Since: GIMP 2.4
 */
gchar *
_gimp_get_color_configuration (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *config = NULL;

219
  return_vals = gimp_run_procedure ("gimp-get-color-configuration",
220 221
                                    &nreturn_vals,
                                    GIMP_PDB_END);
222 223 224 225 226 227 228 229 230

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    config = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return config;
}

231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246
/**
 * gimp_get_module_load_inhibit:
 *
 * Get the list of modules which should not be loaded.
 *
 * Returns a copy of the list of modules which should not be loaded.
 *
 * Returns: The list of modules.
 */
gchar *
gimp_get_module_load_inhibit (void)
{
  GimpParam *return_vals;
  gint nreturn_vals;
  gchar *load_inhibit = NULL;

247
  return_vals = gimp_run_procedure ("gimp-get-module-load-inhibit",
248 249
                                    &nreturn_vals,
                                    GIMP_PDB_END);
250 251 252 253 254 255 256 257

  if (return_vals[0].data.d_status == GIMP_PDB_SUCCESS)
    load_inhibit = g_strdup (return_vals[1].data.d_string);

  gimp_destroy_params (return_vals, nreturn_vals);

  return load_inhibit;
}