Files
gimp/devel-docs/libgimpbase/html/libgimpbase-gimpenv.html
2010-08-11 01:21:23 -04:00

425 lines
17 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>gimpenv</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GIMP Base Library Reference Manual">
<link rel="up" href="libgimpbase.html" title="Part&#160;I.&#160;GIMP Base Library">
<link rel="prev" href="libgimpbase-gimpdatafiles.html" title="gimpdatafiles">
<link rel="next" href="libgimpbase-gimpmemsize.html" title="gimpmemsize">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="part" href="libgimpbase.html" title="Part&#160;I.&#160;GIMP Base Library">
<link rel="index" href="libgimpbase-index.html" title="Index">
<link rel="index" href="libgimpbase-index-new-in-2-2.html" title="Index of new symbols in GIMP 2.2">
<link rel="index" href="libgimpbase-index-new-in-2-4.html" title="Index of new symbols in GIMP 2.4">
<link rel="index" href="libgimpbase-index-deprecated.html" title="Index of deprecated symbols">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="libgimpbase-gimpdatafiles.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgimpbase.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GIMP Base Library Reference Manual</th>
<td><a accesskey="n" href="libgimpbase-gimpmemsize.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2594170" class="shortcut">Top</a>
&#160;|&#160;
<a href="#id2599715" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libgimpbase-gimpenv"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2594170"></a><span class="refentrytitle">gimpenv</span>
</h2>
<p>gimpenv &#8212; Functions to access the GIMP environment.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
void <a href="libgimpbase-gimpenv.html#gimp-env-init">gimp_env_init</a> (gboolean plug_in);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-directory">gimp_directory</a> (void);
gchar* <a href="libgimpbase-gimpenv.html#gimp-personal-rc-file">gimp_personal_rc_file</a> (const gchar *basename);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-data-directory">gimp_data_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-locale-directory">gimp_locale_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-plug-in-directory">gimp_plug_in_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-sysconf-directory">gimp_sysconf_directory</a> (void);
const gchar* <a href="libgimpbase-gimpenv.html#gimp-gtkrc">gimp_gtkrc</a> (void);
GList* <a href="libgimpbase-gimpenv.html#gimp-path-parse">gimp_path_parse</a> (const gchar *path,
gint max_paths,
gboolean check,
GList **check_failed);
gchar* <a href="libgimpbase-gimpenv.html#gimp-path-to-str">gimp_path_to_str</a> (GList *path);
void <a href="libgimpbase-gimpenv.html#gimp-path-free">gimp_path_free</a> (GList *path);
gchar* <a href="libgimpbase-gimpenv.html#gimp-path-get-user-writable-dir">gimp_path_get_user_writable_dir</a> (GList *path);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2599715"></a><h2>Description</h2>
<p>
A set of functions to find the locations of GIMP's data directories and
configuration files.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2599732"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2599743"></a><h3>
<a name="gimp-env-init"></a>gimp_env_init ()</h3>
<a class="indexterm" name="id2599757"></a><pre class="programlisting">void gimp_env_init (gboolean plug_in);</pre>
<p>
You don't need to care about this function. It is being called for
you automatically (by means of the <a
href="../libgimp/libgimp-gimp.html#MAIN:CAPS"
><code class="function">MAIN()</code></a> macro that every plug-in
runs). Calling it again will cause a fatal error.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>plug_in</code></em>&#160;:</span></td>
<td> must be <code class="literal">TRUE</code> if this function is called from a plug-in
</td>
</tr></tbody>
</table></div>
<p class="since">Since GIMP 2.4
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2599835"></a><h3>
<a name="gimp-directory"></a>gimp_directory ()</h3>
<a class="indexterm" name="id2576302"></a><pre class="programlisting">const gchar* gimp_directory (void);</pre>
<p>
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 <a href="libgimpbase-gimpenv.html#gimp-data-directory"><code class="function">gimp_data_directory()</code></a>.
</p>
<p>
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 <a href="libgimpbase-gimpenv.html#gimp-data-directory"><code class="function">gimp_data_directory()</code></a>. In any case, we always
return some non-empty string, whether it corresponds to an existing
directory or not.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The user-specific GIMP settings directory.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2576384"></a><h3>
<a name="gimp-personal-rc-file"></a>gimp_personal_rc_file ()</h3>
<a class="indexterm" name="id2576395"></a><pre class="programlisting">gchar* gimp_personal_rc_file (const gchar *basename);</pre>
<p>
Returns the name of a file in the user-specific GIMP settings directory.
</p>
<p>
The returned string is allocated dynamically and *SHOULD* be freed
with <code class="function">g_free()</code> 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).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>basename</code></em>&#160;:</span></td>
<td> The basename of a rc_file.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The name of a file in the user-specific GIMP settings directory.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2576473"></a><h3>
<a name="gimp-data-directory"></a>gimp_data_directory ()</h3>
<a class="indexterm" name="id2576485"></a><pre class="programlisting">const gchar* gimp_data_directory (void);</pre>
<p>
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.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The top directory for GIMP data.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2576538"></a><h3>
<a name="gimp-locale-directory"></a>gimp_locale_directory ()</h3>
<a class="indexterm" name="id2576549"></a><pre class="programlisting">const gchar* gimp_locale_directory (void);</pre>
<p>
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.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The top directory for GIMP locale files.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2599084"></a><h3>
<a name="gimp-plug-in-directory"></a>gimp_plug_in_directory ()</h3>
<a class="indexterm" name="id2599096"></a><pre class="programlisting">const gchar* gimp_plug_in_directory (void);</pre>
<p>
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.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The top directory for GIMP plug_ins and modules.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2599149"></a><h3>
<a name="gimp-sysconf-directory"></a>gimp_sysconf_directory ()</h3>
<a class="indexterm" name="id2599161"></a><pre class="programlisting">const gchar* gimp_sysconf_directory (void);</pre>
<p>
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.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The top directory for GIMP config files.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2599213"></a><h3>
<a name="gimp-gtkrc"></a>gimp_gtkrc ()</h3>
<a class="indexterm" name="id2599226"></a><pre class="programlisting">const gchar* gimp_gtkrc (void);</pre>
<p>
Returns the name of the GIMP's application-specific gtkrc file.
</p>
<p>
The returned string is owned by GIMP and must not be modified or
freed. The returned string is in the encoding used for filenames by
the system, which isn't necessarily UTF-8 (never is on Windows).</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The name of the GIMP's application-specific gtkrc file.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2599276"></a><h3>
<a name="gimp-path-parse"></a>gimp_path_parse ()</h3>
<a class="indexterm" name="id2599288"></a><pre class="programlisting">GList* gimp_path_parse (const gchar *path,
gint max_paths,
gboolean check,
GList **check_failed);</pre>
<p>
</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> A list of directories separated by <span class="type">G_SEARCHPATH_SEPARATOR</span>.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>max_paths</code></em>&#160;:</span></td>
<td> The maximum number of directories to return.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>check</code></em>&#160;:</span></td>
<td> <code class="literal">TRUE</code> if you want the directories to be checked.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>check_failed</code></em>&#160;:</span></td>
<td> Returns a <span class="type">GList</span> of path elements for which the
check failed.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A <span class="type">GList</span> of all directories in <em class="parameter"><code>path</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2569543"></a><h3>
<a name="gimp-path-to-str"></a>gimp_path_to_str ()</h3>
<a class="indexterm" name="id2564174"></a><pre class="programlisting">gchar* gimp_path_to_str (GList *path);</pre>
<p>
</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><code class="function">gimp_path_parse()</code></a>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> A searchpath string separated by <span class="type">G_SEARCHPATH_SEPARATOR</span>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602656"></a><h3>
<a name="gimp-path-free"></a>gimp_path_free ()</h3>
<a class="indexterm" name="id2602666"></a><pre class="programlisting">void gimp_path_free (GList *path);</pre>
<p>
This function frees the memory allocated for the list and the strings
it contains.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><code class="function">gimp_path_parse()</code></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2602720"></a><h3>
<a name="gimp-path-get-user-writable-dir"></a>gimp_path_get_user_writable_dir ()</h3>
<a class="indexterm" name="id2602730"></a><pre class="programlisting">gchar* gimp_path_get_user_writable_dir (GList *path);</pre>
<p>
Note that you have to <code class="function">g_free()</code> the returned string.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>path</code></em>&#160;:</span></td>
<td> A list of directories as returned by <a href="libgimpbase-gimpenv.html#gimp-path-parse"><code class="function">gimp_path_parse()</code></a>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</span></td>
<td> The first directory in <em class="parameter"><code>path</code></em> where the user has write permission.
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>