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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285
|
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="libgimpbase-gimpenv">
<refmeta>
<refentrytitle role="top_of_page">gimpenv</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>LIBGIMPBASE Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gimpenv</refname>
<refpurpose>Functions to access the GIMP environment.</refpurpose>
<!--[<xref linkend="desc" endterm="desc.title"/>]-->
</refnamediv>
<refsynopsisdiv role="synopsis">
<title role="synopsis.title">Synopsis</title>
<synopsis>
const <link linkend="gchar">gchar</link>* <link linkend="gimp-directory">gimp_directory</link> (void);
<link linkend="gchar">gchar</link>* <link linkend="gimp-personal-rc-file">gimp_personal_rc_file</link> (const <link linkend="gchar">gchar</link> *basename);
const <link linkend="gchar">gchar</link>* <link linkend="gimp-data-directory">gimp_data_directory</link> (void);
const <link linkend="gchar">gchar</link>* <link linkend="gimp-locale-directory">gimp_locale_directory</link> (void);
const <link linkend="gchar">gchar</link>* <link linkend="gimp-plug-in-directory">gimp_plug_in_directory</link> (void);
const <link linkend="gchar">gchar</link>* <link linkend="gimp-sysconf-directory">gimp_sysconf_directory</link> (void);
const <link linkend="gchar">gchar</link>* <link linkend="gimp-gtkrc">gimp_gtkrc</link> (void);
<link linkend="GList">GList</link>* <link linkend="gimp-path-parse">gimp_path_parse</link> (const <link linkend="gchar">gchar</link> *path,
<link linkend="gint">gint</link> max_paths,
<link linkend="gboolean">gboolean</link> check,
<link linkend="GList">GList</link> **check_failed);
<link linkend="gchar">gchar</link>* <link linkend="gimp-path-to-str">gimp_path_to_str</link> (<link linkend="GList">GList</link> *path);
<link linkend="void">void</link> <link linkend="gimp-path-free">gimp_path_free</link> (<link linkend="GList">GList</link> *path);
<link linkend="gchar">gchar</link>* <link linkend="gimp-path-get-user-writable-dir">gimp_path_get_user_writable_dir</link> (<link linkend="GList">GList</link> *path);
</synopsis>
</refsynopsisdiv>
<refsect1 role="desc">
<title role="desc.title">Description</title>
<para>
A set of functions to find the locations of GIMP's data directories and
configuration files.
</para>
</refsect1>
<refsect1 role="details">
<title role="details.title">Details</title>
<refsect2>
<title><anchor id="gimp-directory" role="function"/>gimp_directory ()</title>
<indexterm><primary>gimp_directory</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_directory (void);</programlisting>
<para>
Returns the user-specific GIMP settings directory. If the
environment variable GIMP2_DIRECTORY exists, it is used. If it is
an absolute path, it is used as is. If it is a relative path, it
is taken to be a subdirectory of the home directory. If it is a
relative path, and no home directory can be determined, it is taken
to be a subdirectory of <link linkend="gimp-data-directory"><function>gimp_data_directory()</function></link>.
</para>
<para>
The usual case is that no GIMP2_DIRECTORY environment variable
exists, and then we use the GIMPDIR subdirectory of the home
directory. If no home directory exists, we use a per-user
subdirectory of <link linkend="gimp-data-directory"><function>gimp_data_directory()</function></link>. In any case, we always
return some non-empty string, whether it corresponds to an existing
directory or not.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The user-specific GIMP settings directory.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-personal-rc-file" role="function"/>gimp_personal_rc_file ()</title>
<indexterm><primary>gimp_personal_rc_file</primary></indexterm><programlisting><link linkend="gchar">gchar</link>* gimp_personal_rc_file (const <link linkend="gchar">gchar</link> *basename);</programlisting>
<para>
Returns the name of a file in the user-specific GIMP settings directory.
</para>
<para>
The returned string is allocated dynamically and *SHOULD* be freed
with <link linkend="g-free"><function>g_free()</function></link> after use. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>basename</parameter> :</term>
<listitem><simpara> The basename of a rc_file.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The name of a file in the user-specific GIMP settings directory.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-data-directory" role="function"/>gimp_data_directory ()</title>
<indexterm><primary>gimp_data_directory</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_data_directory (void);</programlisting>
<para>
Returns the top directory for GIMP data. If the environment
variable GIMP2_DATADIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The top directory for GIMP data.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-locale-directory" role="function"/>gimp_locale_directory ()</title>
<indexterm><primary>gimp_locale_directory</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_locale_directory (void);</programlisting>
<para>
Returns the top directory for GIMP locale files. If the environment
variable GIMP2_LOCALEDIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The top directory for GIMP locale files.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-plug-in-directory" role="function"/>gimp_plug_in_directory ()</title>
<indexterm><primary>gimp_plug_in_directory</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_plug_in_directory (void);</programlisting>
<para>
Returns the top directory for GIMP plug_ins and modules. If the
environment variable GIMP2_PLUGINDIR exists, that is used. It
should be an absolute pathname. Otherwise, on Unix the compile-time
defined directory is used. On Win32, the installation directory as
deduced from the executable's name is used.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The top directory for GIMP plug_ins and modules.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-sysconf-directory" role="function"/>gimp_sysconf_directory ()</title>
<indexterm><primary>gimp_sysconf_directory</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_sysconf_directory (void);</programlisting>
<para>
Returns the top directory for GIMP config files. If the environment
variable GIMP2_SYSCONFDIR exists, that is used. It should be an
absolute pathname. Otherwise, on Unix the compile-time defined
directory is used. On Win32, the installation directory as deduced
from the executable's name is used.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The top directory for GIMP config files.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-gtkrc" role="function"/>gimp_gtkrc ()</title>
<indexterm><primary>gimp_gtkrc</primary></indexterm><programlisting>const <link linkend="gchar">gchar</link>* gimp_gtkrc (void);</programlisting>
<para>
Returns the name of the GIMP's application-specific gtkrc file.
</para>
<para>
The returned string is allocated just once, and should *NOT* be
freed with <link linkend="g-free"><function>g_free()</function></link>. The returned string is in the encoding used
for filenames by the system, which isn't necessarily UTF-8 (never
is on Windows).</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The name of the GIMP's application-specific gtkrc file.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-path-parse" role="function"/>gimp_path_parse ()</title>
<indexterm><primary>gimp_path_parse</primary></indexterm><programlisting><link linkend="GList">GList</link>* gimp_path_parse (const <link linkend="gchar">gchar</link> *path,
<link linkend="gint">gint</link> max_paths,
<link linkend="gboolean">gboolean</link> check,
<link linkend="GList">GList</link> **check_failed);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter> :</term>
<listitem><simpara> A list of directories separated by <link linkend="G-SEARCHPATH-SEPARATOR:CAPS"><type>G_SEARCHPATH_SEPARATOR</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>max_paths</parameter> :</term>
<listitem><simpara> The maximum number of directories to return.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>check</parameter> :</term>
<listitem><simpara> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if you want the directories to be checked.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>check_failed</parameter> :</term>
<listitem><simpara> Returns a <link linkend="GList"><type>GList</type></link> of path elements for which the
check failed.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> A <link linkend="GList"><type>GList</type></link> of all directories in <parameter>path</parameter>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-path-to-str" role="function"/>gimp_path_to_str ()</title>
<indexterm><primary>gimp_path_to_str</primary></indexterm><programlisting><link linkend="gchar">gchar</link>* gimp_path_to_str (<link linkend="GList">GList</link> *path);</programlisting>
<para>
</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter> :</term>
<listitem><simpara> A list of directories as returned by <link linkend="gimp-path-parse"><function>gimp_path_parse()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> A searchpath string separated by <link linkend="G-SEARCHPATH-SEPARATOR:CAPS"><type>G_SEARCHPATH_SEPARATOR</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-path-free" role="function"/>gimp_path_free ()</title>
<indexterm><primary>gimp_path_free</primary></indexterm><programlisting><link linkend="void">void</link> gimp_path_free (<link linkend="GList">GList</link> *path);</programlisting>
<para>
This function frees the memory allocated for the list and the strings
it contains.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter> :</term>
<listitem><simpara> A list of directories as returned by <link linkend="gimp-path-parse"><function>gimp_path_parse()</function></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2>
<title><anchor id="gimp-path-get-user-writable-dir" role="function"/>gimp_path_get_user_writable_dir ()</title>
<indexterm><primary>gimp_path_get_user_writable_dir</primary></indexterm><programlisting><link linkend="gchar">gchar</link>* gimp_path_get_user_writable_dir (<link linkend="GList">GList</link> *path);</programlisting>
<para>
Note that you have to <link linkend="g-free"><function>g_free()</function></link> the returned string.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>path</parameter> :</term>
<listitem><simpara> A list of directories as returned by <link linkend="gimp-path-parse"><function>gimp_path_parse()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis> :</term><listitem><simpara> The first directory in <parameter>path</parameter> where the user has write permission.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
</refsect1>
</refentry>
|