| Libgami Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
GamiResponseGamiResponse — The response type returned by GamiManager actions |
#include <gami.h>
GamiResponse;
GamiResponse * gami_response_new (GValue *value,
gchar *message,
gchar *action_id);
GamiResponse * gami_response_ref (GamiResponse *response);
void gami_response_unref (GamiResponse *response);
gboolean gami_response_success (GamiResponse *response);
const gchar * gami_response_message (GamiResponse *response);
const gchar * gami_response_action_id (GamiResponse *response);
GValue * gami_response_value (GamiResponse *response);
#define G_TYPE_SLIST
GType g_slist_get_type (void);
typedef struct _GamiResponse GamiResponse;
The data type used to encapsulate manager responses. All the fields in the GamiResponse structure are private to the GamiResponse implementation and should never be accessed directly.
GamiResponse * gami_response_new (GValue *value, gchar *message, gchar *action_id);
This function creates an instance of GAMI_TYPE_RESPONSE
|
the GValue of the response |
|
the message header of the response packet |
|
the ActionID header of the response packet |
Returns : |
A new GamiResponse |
GamiResponse * gami_response_ref (GamiResponse *response);
Atomically increments the reference count of response by one.
|
a valid GamiResponse |
Returns : |
the passed in GamiResponse |
void gami_response_unref (GamiResponse *response);
Atomically decrements the reference count of response by one. If the
reference count drops to 0, all elements will be destroyed, and all memory
allocated by the response is released.
|
a valid GamiResponse |
gboolean gami_response_success (GamiResponse *response);
Check whether the action associated with response indicated success
|
the GamiResponse to check |
Returns : |
TRUE if the action indicated success, otherwise FALSE
|
const gchar * gami_response_message (GamiResponse *response);
Get the message header of the response packet. The returned string belongs
to the GamiResponse structure and should not be freed or modified. Note
that the Message header is not mandatory in older AMI API versions, so
you should expect a return value of NULL.
|
a valid GamiResponse |
Returns : |
the message header of response if set, or NULL otherwise
|
const gchar * gami_response_action_id (GamiResponse *response);
Get the ActionID header of the response packet. The string returned belongs to the GamiResponse structure and must not be freed or modified. This function will only return a value if an action_id was passed to the associated action.
|
a valid GamiResponse |
Returns : |
the action_id associated with response's action or NULL
|
GValue * gami_response_value (GamiResponse *response);
Get the value of the response packet. The type of the GValue depends
on the action associated with response. It should be one of G_TYPE_BOOLEAN,
G_TYPE_SLIST, G_TYPE_STRING or G_TYPE_HASH_TABLE. Consult the
documentation for AmiManager to see which type should be expected for each
action. If the action failed, the type will always be G_TYPE_BOOLEAN with
a value of FALSE.
|
a valid GamiResponse |
Returns : |
the value returned by the action associated with response
|
#define G_TYPE_SLIST (g_slist_get_type ())
Get the GType of GSList. This will hopefully become part of gobject like GTypeHashTable - unfortunately, it is not.