|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /usr/share/gtk-doc/html/libgnome/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>gnome-triggers</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
<link rel="start" href="index.html" title="GNOME Library Reference Manual">
<link rel="up" href="ch01s04.html" title="Miscellaneous">
<link rel="prev" href="libgnome-gnome-sound.html" title="gnome-sound">
<link rel="next" href="ch01s05.html" title="Lower level interactions">
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="libgnome.html" title="GNOME Library (libgnome)">
</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="libgnome-gnome-sound.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01s04.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">GNOME Library Reference Manual</th>
<td><a accesskey="n" href="ch01s05.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="#id2827893" class="shortcut">Top</a>
 | 
<a href="#id2828686" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="libgnome-gnome-triggers"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2827893"></a><span class="refentrytitle">gnome-triggers</span>
</h2>
<p>gnome-triggers — Hierarchical signal mechanism for GNOME events.</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <libgnome/libgnome.h>
enum <a href="libgnome-gnome-triggers.html#GnomeTriggerType">GnomeTriggerType</a>;
void (<a href="libgnome-gnome-triggers.html#GnomeTriggerActionFunction">*GnomeTriggerActionFunction</a>) (char *msg,
char *level,
char *supinfo[]);
<a href="libgnome-gnome-triggers.html#GnomeTrigger">GnomeTrigger</a>;
void <a href="libgnome-gnome-triggers.html#gnome-triggers-add-trigger">gnome_triggers_add_trigger</a> (<a href="libgnome-gnome-triggers.html#GnomeTrigger">GnomeTrigger</a> *nt,
...);
void <a href="libgnome-gnome-triggers.html#gnome-triggers-vadd-trigger">gnome_triggers_vadd_trigger</a> (<a href="libgnome-gnome-triggers.html#GnomeTrigger">GnomeTrigger</a> *nt,
char *supinfo[]);
void <a href="libgnome-gnome-triggers.html#gnome-triggers-do">gnome_triggers_do</a> (const char *msg,
const char *level,
...);
void <a href="libgnome-gnome-triggers.html#gnome-triggers-vdo">gnome_triggers_vdo</a> (const char *msg,
const char *level,
const char *supinfo[]);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2828686"></a><h2>Description</h2>
<p>
The triggers API provides a way for applications to tell GNOME about
interesting events that then cause something to happen (for example, playing a
sound). An event can either be a function that is called, a sound that is
played or an external command that is run.
</p>
<p>
Each trigger can optionally have a <em class="wordasword">level</em> associated
with it and a <em class="wordasword">section</em>. The
<em class="wordasword">section</em> is a list of strings that help to classify the
event, which imposes a hierarchy on the trigger system. For example, messages
about the hard drive partition /dev/hda1 may come under the section ("system",
"device", "disk", "/dev/hda1"). This means that an application could trigger
all events for the ("system", "device") sections and include those events, or
be more specific and just trigger those for ("system", "device", "disk",
"/dev/hda1").
</p>
<p>
At the present time, triggers are not widely used in GNOME, being mostly used
to play sound events in response to certain actions.
</p>
</div>
<div class="refsect1" lang="en">
<a name="id2828734"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2828744"></a><h3>
<a name="GnomeTriggerType"></a>enum GnomeTriggerType</h3>
<a class="indexterm" name="id2828757"></a><pre class="programlisting">typedef enum {
GTRIG_NONE,
GTRIG_FUNCTION,
GTRIG_COMMAND,
GTRIG_MEDIAPLAY
} GnomeTriggerType;
</pre>
<p>
These are the different types of triggers that can be activated by an
application.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><a name="GTRIG-NONE:CAPS"></a><code class="literal">GTRIG_NONE</code></span></td>
<td>A null trigger type. Should never be used.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTRIG-FUNCTION:CAPS"></a><code class="literal">GTRIG_FUNCTION</code></span></td>
<td>The trigger causes a function to be executed.
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTRIG-COMMAND:CAPS"></a><code class="literal">GTRIG_COMMAND</code></span></td>
<td>The trigger causes a command to be executed (using <code class="function">execv()</code>).
</td>
</tr>
<tr>
<td>
<span class="term"><a name="GTRIG-MEDIAPLAY:CAPS"></a><code class="literal">GTRIG_MEDIAPLAY</code></span></td>
<td>The trigger causes a sound to be played.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2828880"></a><h3>
<a name="GnomeTriggerActionFunction"></a>GnomeTriggerActionFunction ()</h3>
<a class="indexterm" name="id2828894"></a><pre class="programlisting">void (*GnomeTriggerActionFunction) (char *msg,
char *level,
char *supinfo[]);</pre>
<p>
The signature of a function that can used as a target for <a href="libgnome-gnome-triggers.html#GTRIG-FUNCTION:CAPS"><span class="type">GTRIG_FUNCTION</span></a>
types of <a href="libgnome-gnome-triggers.html#GnomeTrigger"><span class="type">GnomeTrigger</span></a> instances.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>msg</code></em> :</span></td>
<td>The human-readable message that was passed to <a href="libgnome-gnome-triggers.html#gnome-triggers-do"><code class="function">gnome_triggers_do()</code></a>. May be
<a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>level</code></em> :</span></td>
<td>The severity level of the event. May be <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>supinfo</code></em> :</span></td>
<td>The section in which the event belongs. This is a <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a> terminated
array.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2829044"></a><h3>
<a name="GnomeTrigger"></a>GnomeTrigger</h3>
<a class="indexterm" name="id2829057"></a><pre class="programlisting">typedef struct {
GnomeTriggerType type;
union {
/*
* These will be passed the same info as
* gnome_triggers_do was given.
*/
GnomeTriggerActionFunction function;
gchar *command;
struct {
gchar *file;
int cache_id;
} media;
} u;
gchar *level;
} GnomeTrigger;
</pre>
<p>
This structure stores the information about an action that is triggered for
a particular event. A filled in instance of this structure is passed to
<a href="libgnome-gnome-triggers.html#gnome-triggers-add-trigger"><code class="function">gnome_triggers_add_trigger()</code></a> and <a href="libgnome-gnome-triggers.html#gnome-triggers-vadd-trigger"><code class="function">gnome_triggers_vadd_trigger()</code></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2829102"></a><h3>
<a name="gnome-triggers-add-trigger"></a>gnome_triggers_add_trigger ()</h3>
<a class="indexterm" name="id2829115"></a><pre class="programlisting">void gnome_triggers_add_trigger (<a href="libgnome-gnome-triggers.html#GnomeTrigger">GnomeTrigger</a> *nt,
...);</pre>
<p>
Adds a new <a href="libgnome-gnome-triggers.html#GnomeTrigger"><span class="type">GnomeTrigger</span></a> instance to the event hierarchy.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nt</code></em> :</span></td>
<td> Information on the new trigger to be added.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> The section to add the trigger under.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2829189"></a><h3>
<a name="gnome-triggers-vadd-trigger"></a>gnome_triggers_vadd_trigger ()</h3>
<a class="indexterm" name="id2829203"></a><pre class="programlisting">void gnome_triggers_vadd_trigger (<a href="libgnome-gnome-triggers.html#GnomeTrigger">GnomeTrigger</a> *nt,
char *supinfo[]);</pre>
<p>
This does the same as <a href="libgnome-gnome-triggers.html#gnome-triggers-add-trigger"><code class="function">gnome_triggers_add_trigger()</code></a>, except the section is
stored in the <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a> terminated array <em class="parameter"><code>supinfo</code></em> instead of as a variable
length argument list.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>nt</code></em> :</span></td>
<td> Information on the new trigger to be added.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>supinfo</code></em> :</span></td>
<td> The section to add the trigger under.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2829305"></a><h3>
<a name="gnome-triggers-do"></a>gnome_triggers_do ()</h3>
<a class="indexterm" name="id2829318"></a><pre class="programlisting">void gnome_triggers_do (const char *msg,
const char *level,
...);</pre>
<p>
Notifies GNOME about an event happening, so that any appropriate handlers
can be run.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>msg</code></em> :</span></td>
<td> The human-readable message describing the event (can be <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>level</code></em> :</span></td>
<td> The level of severity of the event, or <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>...</code></em> :</span></td>
<td> The classification of the event.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2829426"></a><h3>
<a name="gnome-triggers-vdo"></a>gnome_triggers_vdo ()</h3>
<a class="indexterm" name="id2829439"></a><pre class="programlisting">void gnome_triggers_vdo (const char *msg,
const char *level,
const char *supinfo[]);</pre>
<p>
Notifies GNOME about an event happening, so that any appropriate handlers
can be run. This does the same as <code class="function">gnome_trigger_do()</code> except that it takes a
<a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a> terminated array instead of a varargs list.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td>
<span class="term"><em class="parameter"><code>msg</code></em> :</span></td>
<td> The human-readable message describing the event (can be <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>).
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>level</code></em> :</span></td>
<td> The level of severity of the event, or <a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a>.
</td>
</tr>
<tr>
<td>
<span class="term"><em class="parameter"><code>supinfo</code></em> :</span></td>
<td> The classification of the event (<a
href="/usr/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"
><code class="literal">NULL</code></a> terminated array).
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>