MATE Library Reference Manual | ||||
---|---|---|---|---|
Top | Description |
#include <libmate/libmate.h> enum MateTriggerType; void (*MateTriggerActionFunction) (char *msg
,char *level
,char *supinfo[]
); MateTrigger; void mate_triggers_add_trigger (MateTrigger *nt
,...
); void mate_triggers_vadd_trigger (MateTrigger *nt
,char *supinfo[]
); void mate_triggers_do (const char *msg
,const char *level
,...
); void mate_triggers_vdo (const char *msg
,const char *level
,const char *supinfo[]
);
The triggers API provides a way for applications to tell MATE 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.
Each trigger can optionally have a level associated with it and a section. The section 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").
At the present time, triggers are not widely used in MATE, being mostly used to play sound events in response to certain actions.
typedef enum { GTRIG_NONE, GTRIG_FUNCTION, GTRIG_COMMAND, GTRIG_MEDIAPLAY } MateTriggerType;
These are the different types of triggers that can be activated by an application.
void (*MateTriggerActionFunction) (char *msg
,char *level
,char *supinfo[]
);
The signature of a function that can used as a target for GTRIG_FUNCTION types of MateTrigger instances.
|
The human-readable message that was passed to mate_triggers_do() . May be
NULL .
|
|
The severity level of the event. May be NULL .
|
|
The section in which the event belongs. This is a NULL terminated
array.
|
typedef struct { MateTriggerType type; union { /* * These will be passed the same info as * mate_triggers_do was given. */ MateTriggerActionFunction function; gchar *command; struct { gchar *file; int cache_id; } media; } u; gchar *level; } MateTrigger;
void mate_triggers_add_trigger (MateTrigger *nt
,...
);
Adds a new MateTrigger instance to the event hierarchy.
|
Information on the new trigger to be added. |
|
The section to add the trigger under. |
void mate_triggers_vadd_trigger (MateTrigger *nt
,char *supinfo[]
);
This does the same as mate_triggers_add_trigger()
, except the section is
stored in the NULL
terminated array supinfo
instead of as a variable
length argument list.
|
Information on the new trigger to be added. |
|
The section to add the trigger under. |
void mate_triggers_do (const char *msg
,const char *level
,...
);
Notifies MATE about an event happening, so that any appropriate handlers can be run.
void mate_triggers_vdo (const char *msg
,const char *level
,const char *supinfo[]
);
Notifies MATE about an event happening, so that any appropriate handlers
can be run. This does the same as mate_trigger_do()
except that it takes a
NULL
terminated array instead of a varargs list.