GamiResponse

GamiResponse — The response type returned by GamiManager actions

Stability Level

Unstable, unless otherwise indicated

Synopsis


#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);

Description

Details

GamiResponse

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.


gami_response_new ()

GamiResponse *      gami_response_new                   (GValue *value,
                                                         gchar *message,
                                                         gchar *action_id);

This function creates an instance of GAMI_TYPE_RESPONSE

value :

the GValue of the response

message :

the message header of the response packet

action_id :

the ActionID header of the response packet

Returns :

A new GamiResponse

gami_response_ref ()

GamiResponse *      gami_response_ref                   (GamiResponse *response);

Atomically increments the reference count of response by one.

response :

a valid GamiResponse

Returns :

the passed in GamiResponse

gami_response_unref ()

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.

response :

a valid GamiResponse

gami_response_success ()

gboolean            gami_response_success               (GamiResponse *response);

Check whether the action associated with response indicated success

response :

the GamiResponse to check

Returns :

TRUE if the action indicated success, otherwise FALSE

gami_response_message ()

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.

response :

a valid GamiResponse

Returns :

the message header of response if set, or NULL otherwise

gami_response_action_id ()

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.

response :

a valid GamiResponse

Returns :

the action_id associated with response's action or NULL

gami_response_value ()

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.

response :

a valid GamiResponse

Returns :

the value returned by the action associated with response

G_TYPE_SLIST

#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.

Returns :

The GType of GSList

g_slist_get_type ()

GType               g_slist_get_type                    (void);

Get the GType of GSList. This will hopefully become part of gobject like GTypeHashTable - unfortunately, it is not.

Returns :

The GType of GSList