Add the MATRIX_API_CALLBACK_PROTO convenience macro
It can ease creating API callback function headers.
This commit is contained in:
parent
def0f85086
commit
2f366ee30d
@ -236,6 +236,7 @@ matrix_presence_event_get_type
|
|||||||
<TITLE>MatrixAPI</TITLE>
|
<TITLE>MatrixAPI</TITLE>
|
||||||
MatrixAPIInterface
|
MatrixAPIInterface
|
||||||
MatrixAPICallback
|
MatrixAPICallback
|
||||||
|
MATRIX_API_CALLBACK_PROTO
|
||||||
|
|
||||||
<SUBSECTION>
|
<SUBSECTION>
|
||||||
matrix_api_set_token
|
matrix_api_set_token
|
||||||
|
@ -120,6 +120,26 @@
|
|||||||
* @raw_content will be set.
|
* @raw_content will be set.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MATRIX_API_CALLBACK_PROTO:
|
||||||
|
* @name: the name of the function
|
||||||
|
*
|
||||||
|
* Convenience macro to define a #MatrixAPICallback function. The
|
||||||
|
* parameter names in the defined function will be the same as defined
|
||||||
|
* in #MatrixAPICallback.
|
||||||
|
*
|
||||||
|
* |[<!-- language="C" -->
|
||||||
|
* // Use it for prototypes…
|
||||||
|
* MATRIX_API_CALLBACK_PROTO(my_fancy_callback);
|
||||||
|
*
|
||||||
|
* // …or for the implementation.
|
||||||
|
* MATRIX_API_CALLBACK_PROTO(my_fancy_callback)
|
||||||
|
* {
|
||||||
|
* do_callback_stuff(api, json_content);
|
||||||
|
* }
|
||||||
|
* ]|
|
||||||
|
*/
|
||||||
|
|
||||||
G_DEFINE_INTERFACE(MatrixAPI, matrix_api, G_TYPE_OBJECT);
|
G_DEFINE_INTERFACE(MatrixAPI, matrix_api, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -41,6 +41,14 @@ typedef void (*MatrixAPICallback)(MatrixAPI *api,
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GError *err);
|
GError *err);
|
||||||
|
|
||||||
|
#define MATRIX_API_CALLBACK_PROTO(name) static void \
|
||||||
|
name (MatrixAPI *api, \
|
||||||
|
const gchar *content_type, \
|
||||||
|
JsonNode *json_content, \
|
||||||
|
GByteArray *raw_content, \
|
||||||
|
gpointer user_data, \
|
||||||
|
GError *error)
|
||||||
|
|
||||||
struct _MatrixAPIInterface {
|
struct _MatrixAPIInterface {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GTypeInterface g_iface;
|
GTypeInterface g_iface;
|
||||||
|
Loading…
Reference in New Issue
Block a user