Add a GError parameter to MatrixAPICallback

This commit is contained in:
Gergely Polonkai 2015-12-15 11:09:51 +01:00
parent 6b6b3b8954
commit e15df6ea2e
4 changed files with 8 additions and 3 deletions

View File

@ -70,6 +70,7 @@
* @api: A #MatrixAPI implementation * @api: A #MatrixAPI implementation
* @content: the JSON content of the response, as a #JsonNode * @content: the JSON content of the response, as a #JsonNode
* @data: User data specified when calling original request function * @data: User data specified when calling original request function
* @err: a #GError
* *
* A callback function to use with API calls. * A callback function to use with API calls.
*/ */

View File

@ -32,7 +32,10 @@ G_BEGIN_DECLS
typedef struct _MatrixAPIInterface MatrixAPIInterface; typedef struct _MatrixAPIInterface MatrixAPIInterface;
typedef struct _MatrixAPI MatrixAPI; typedef struct _MatrixAPI MatrixAPI;
typedef void (*MatrixAPICallback)(MatrixAPI *api, JsonNode *content, gpointer data); typedef void (*MatrixAPICallback)(MatrixAPI *api,
JsonNode *content,
gpointer data,
GError **err);
struct _MatrixAPIInterface { struct _MatrixAPIInterface {
/*< private >*/ /*< private >*/

View File

@ -376,7 +376,8 @@ response_callback(SoupSession *session,
request->callback( request->callback(
MATRIX_API(api), MATRIX_API(api),
content, content,
request->callback_data); request->callback_data,
NULL);
} }
} else { } else {
g_debug("Invalid response: %s", data); g_debug("Invalid response: %s", data);

View File

@ -31,7 +31,7 @@ static GOptionEntry entries[] = {
}; };
static void static void
login_finished(MatrixAPI *api, JsonNode *content, gpointer data) login_finished(MatrixAPI *api, JsonNode *content, gpointer data, GError **err)
{ {
JsonPath *path = json_path_new(); JsonPath *path = json_path_new();
JsonNode *result; JsonNode *result;