From 52ab5132a4f7c4d982c13183e937775e379a975a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 9 Aug 2022 11:03:34 +0200 Subject: meson: Add rest header to generate_gir Allows bindings to use the single header --- rest/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/rest/meson.build b/rest/meson.build index 0a16c36..fd3ae79 100644 --- a/rest/meson.build +++ b/rest/meson.build @@ -92,6 +92,7 @@ if get_option('introspection') namespace: 'Rest', symbol_prefix: 'rest', identifier_prefix: 'Rest', + header: 'rest/rest.h', export_packages: librest_pkg_string, includes: [ 'GObject-2.0', 'Gio-2.0', 'Soup-@0@'.format(libsoup_api_version) ], extra_args: librest_gir_extra_args, -- cgit v1.2.1 From c7d7f8e8fed38fee172d46705f50118ec9549fe1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 9 Aug 2022 11:07:14 +0200 Subject: params: Fix annotations with rest_params_iter_next The parameters are not optional as they are always accessed. They can be NULL when the iter is finished, actually always set it so that we are sure to always have an initialized variable --- rest/rest-params.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/rest/rest-params.c b/rest/rest-params.c index f2ac286..bddd3c1 100644 --- a/rest/rest-params.c +++ b/rest/rest-params.c @@ -281,12 +281,14 @@ rest_params_iter_init (RestParamsIter *iter, /** * rest_params_iter_next: * @iter: an initialized #RestParamsIter - * @name: (out) (optional): a location to store the name, or %NULL - * @param: (out) (optional): a location to store the #RestParam, or %NULL + * @name: (out) (optional) (nullable) (transfer none): a location to store the name, + * or %NULL + * @param: (out) (optional) (nullable) (transfer none): a location to store the + * #RestParam, or %NULL * * Advances @iter and retrieves the name and/or parameter that are now pointed - * at as a result of this advancement. If FALSE is returned, @name and @param - * are not set and the iterator becomes invalid. + * at as a result of this advancement. If %FALSE is returned, @name and @param + * are set to %NULL and the iterator becomes invalid. * * Returns: %FALSE if the end of the #RestParams has been reached, %TRUE otherwise. **/ @@ -302,10 +304,20 @@ rest_params_iter_next (RestParamsIter *iter, iter->position++; cur = g_list_nth (iter->params->params, iter->position); - if (cur == NULL) return FALSE; + if (cur == NULL) + { + if (param) + *param = NULL; + if (name) + *name = NULL; + return FALSE; + } + + if (param) + *param = cur->data; + if (name) + *name = rest_param_get_name (*param); - *param = cur->data; - *name = rest_param_get_name (*param); return TRUE; } -- cgit v1.2.1 From b55a7aad46554658916e57c28e024fa34e0b1e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 9 Aug 2022 11:16:39 +0200 Subject: Make the single-header usable The pkg-config is only declaring the rest-1.0 directory so we always need to use rest/rest-foo.h and not rest-foo.h Also make sure to include all the headers. --- rest/meson.build | 5 ----- rest/rest-oauth2-proxy-call.c | 1 + rest/rest-oauth2-proxy-call.h | 3 ++- rest/rest.h | 17 ++++++++++++----- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/rest/meson.build b/rest/meson.build index fd3ae79..224b24a 100644 --- a/rest/meson.build +++ b/rest/meson.build @@ -79,13 +79,8 @@ endif if get_option('introspection') librest_gir_extra_args = [ '--accept-unprefixed', - '--c-include=rest/rest-enum-types.h', ] - foreach header : librest_headers - librest_gir_extra_args += '--c-include=rest/@0@'.format(header) - endforeach - librest_gir = gnome.generate_gir(librest_lib, sources: librest_sources + librest_headers + librest_enums, nsversion: librest_api_version, diff --git a/rest/rest-oauth2-proxy-call.c b/rest/rest-oauth2-proxy-call.c index 88840b3..cfed247 100644 --- a/rest/rest-oauth2-proxy-call.c +++ b/rest/rest-oauth2-proxy-call.c @@ -17,6 +17,7 @@ */ #include "rest-oauth2-proxy-call.h" +#include "rest-oauth2-proxy.h" G_DEFINE_TYPE (RestOAuth2ProxyCall, rest_oauth2_proxy_call, REST_TYPE_PROXY_CALL) diff --git a/rest/rest-oauth2-proxy-call.h b/rest/rest-oauth2-proxy-call.h index 799157d..3da126d 100644 --- a/rest/rest-oauth2-proxy-call.h +++ b/rest/rest-oauth2-proxy-call.h @@ -18,7 +18,8 @@ #pragma once -#include +#include +#include G_BEGIN_DECLS diff --git a/rest/rest.h b/rest/rest.h index 0c4afbb..4dbd135 100644 --- a/rest/rest.h +++ b/rest/rest.h @@ -25,11 +25,18 @@ G_BEGIN_DECLS #define REST_INSIDE -# include "rest-proxy.h" -# include "rest-proxy-call.h" -# include "rest-oauth2-proxy.h" -# include "rest-utils.h" -# include "rest-pkce-code-challenge.h" +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include +# include #undef REST_INSIDE G_END_DECLS -- cgit v1.2.1 From 89c2b46fcad2b4b168e14b62a794417036532208 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 9 Aug 2022 11:19:40 +0200 Subject: vala: Add Rest-1.0.metadata Fixes some missing symbols that are supported by Vala but not by the GObject introspection yet. --- rest/Rest-1.0.metadata | 31 +++++++++++++++++++++++++++++++ rest/meson.build | 1 + 2 files changed, 32 insertions(+) create mode 100644 rest/Rest-1.0.metadata diff --git a/rest/Rest-1.0.metadata b/rest/Rest-1.0.metadata new file mode 100644 index 0000000..ed5d476 --- /dev/null +++ b/rest/Rest-1.0.metadata @@ -0,0 +1,31 @@ +OAuth2Proxy cprefix="oauth2_proxy_" +OAuth2ProxyCall cprefix="oauth2_proxy_call_" +Proxy + .new_call skip=false + .bind skip=false +ProxyCall + .get_params skip=false + .get_response_headers skip=false + .add_headers skip=false + .add_params skip=false + .continuous skip=false + .upload skip=false + .cancel skip=false +XmlNode + .ref skip=false + .unref skip=false + +ProxyCallAsyncCallback + .error nullable=true + .weak_object nullable=true + .userdata closure=3 +ProxyCallContinuousCallback + .error nullable=true + .weak_object nullable=true + .userdata closure=5 +ProxyCallUploadCallback + .error nullable=true + .weak_object nullable=true + .userdata closure=5 + +*.ref unowned \ No newline at end of file diff --git a/rest/meson.build b/rest/meson.build index 224b24a..8e69a86 100644 --- a/rest/meson.build +++ b/rest/meson.build @@ -99,6 +99,7 @@ if get_option('introspection') librest_vapi = gnome.generate_vapi(librest_pkg_string, sources: librest_gir [0], packages: [ 'glib-2.0', 'libsoup-@0@'.format(libsoup_api_version) ], + metadata_dirs : meson.current_source_dir(), install: true, ) endif -- cgit v1.2.1 From a030c1f564dd971cd530d967dc94bf5a5bb217aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Corentin=20No=C3=ABl?= Date: Tue, 9 Aug 2022 11:33:04 +0200 Subject: Name the RestOAuth2Error enum This allows it to be used in the GObject introspection --- rest/rest-oauth2-proxy.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest/rest-oauth2-proxy.h b/rest/rest-oauth2-proxy.h index dd4148e..c63d33e 100644 --- a/rest/rest-oauth2-proxy.h +++ b/rest/rest-oauth2-proxy.h @@ -37,10 +37,10 @@ struct _RestOAuth2ProxyClass gpointer padding[8]; }; -enum { +typedef enum { REST_OAUTH2_ERROR_NO_REFRESH_TOKEN, REST_OAUTH2_ERROR_ACCESS_TOKEN_EXPIRED, -}; +} RestOAuth2Error; #define REST_OAUTH2_ERROR rest_oauth2_error_quark () GQuark rest_oauth2_error_quark (); -- cgit v1.2.1