From 30b7ccfe9048560989c37bd3e00ff81d16919d55 Mon Sep 17 00:00:00 2001 From: kotontrion Date: Sun, 19 May 2024 13:15:36 +0200 Subject: fix header paths --- examples/full_example.c | 2 +- examples/simple_example.c | 2 +- include/auth.h | 102 ++++++++++++++++++++++++++++++++++++++++++++++ include/meson.build | 4 +- include/pam.h | 102 ---------------------------------------------- meson.build | 3 +- src/meson.build | 4 +- src/pam.c | 2 +- 8 files changed, 111 insertions(+), 110 deletions(-) create mode 100644 include/auth.h delete mode 100644 include/pam.h diff --git a/examples/full_example.c b/examples/full_example.c index 5174edd..844f423 100644 --- a/examples/full_example.c +++ b/examples/full_example.c @@ -1,4 +1,4 @@ -#include "pam.h" +#include "auth.h" #include GMainLoop *loop; diff --git a/examples/simple_example.c b/examples/simple_example.c index e48bc78..257c2fe 100644 --- a/examples/simple_example.c +++ b/examples/simple_example.c @@ -1,5 +1,5 @@ #include -#include "pam.h" +#include "auth.h" GMainLoop *loop; diff --git a/include/auth.h b/include/auth.h new file mode 100644 index 0000000..bc1c28c --- /dev/null +++ b/include/auth.h @@ -0,0 +1,102 @@ +#ifndef ASTAL_AUTH_PAM_H +#define ASTAL_AUTH_PAM_H + +#include +#include + +G_BEGIN_DECLS + +#define ASTAL_AUTH_TYPE_PAM (astal_auth_pam_get_type()) + +G_DECLARE_FINAL_TYPE (AstalAuthPam, astal_auth_pam, ASTAL_AUTH, PAM, GObject) + +/** + * astal_auth_pam_set_username + * @self: a AstalAuthPam object + * @username: the new username + * + * Sets the username to be used for authentication. This must be set to + * before calling start_authenticate. + * Changing it afterwards has no effect on the authentication process. + * + * Defaults to the owner of the process. + * + */ +void astal_auth_pam_set_username(AstalAuthPam *self, const gchar *username); + +/** + * astal_auth_pam_get_username + * @self: a AstalAuthPam object + * + * Fetches the username from AsalAuthPam object. + * + * Returns: the username of the AsalAuthPam object. This string is + * owned by the object and must not be modified or freed. + */ +const gchar *astal_auth_pam_get_username(AstalAuthPam *self); + +/** + * astal_auth_pam_set_service + * @self: a AstalAuthPam object + * @service: the pam service used for authentication + * + * Sets the service to be used for authentication. This must be set to + * before calling start_authenticate. + * Changing it afterwards has no effect on the authentication process. + * + * Defaults to `astal-auth`. + * + */ +void astal_auth_pam_set_service(AstalAuthPam *self, const gchar *service); + +/** + * astal_auth_pam_get_service + * @self: a AstalAuthPam + * + * Fetches the service from AsalAuthPam object. + * + * Returns: the service of the AsalAuthPam object. This string is + * owned by the object and must not be modified or freed. + */ +const gchar *astal_auth_pam_get_service(AstalAuthPam *self); + + +/** + * astal_auth_pam_start_authentication: + * @self: a AstalAuthPam Object + * + * starts a new authentication process using the PAM (Pluggable Authentication Modules) system. + * Note that this will cancel an already running authentication process + * associated with this AstalAuthPam object. + */ +gboolean astal_auth_pam_start_authenticate(AstalAuthPam *self); + +/** + * astal_auth_pam_supply_secret + * @self: a AstalAuthPam Object + * @secret: (nullable) the secret to be provided to pam. Can be NULL. + * + * provides pam with a secret. This method must be called exactly once after a + * auth-* signal is emitted. + */ +void astal_auth_pam_supply_secret(AstalAuthPam *self, const gchar *secret); + +/** + * astal_auth_pam_authenticate: + * @password: the password to be authenticated + * @result_callback: (scope async) (closure user_data): a GAsyncReadyCallback + * to call when the request is satisfied + * @user_data: the data to pass to callback function + * + * Requests authentication of the provided password using the PAM (Pluggable Authentication Modules) system. + */ +gboolean astal_auth_pam_authenticate(const gchar *password, + GAsyncReadyCallback result_callback, + gpointer user_data); + +gssize astal_auth_pam_authenticate_finish(GAsyncResult *res, + GError **error); + +G_END_DECLS + +#endif // !ASTAL_AUTH_PAM_H diff --git a/include/meson.build b/include/meson.build index 59db862..3db00c1 100644 --- a/include/meson.build +++ b/include/meson.build @@ -1,4 +1,4 @@ astal_auth_inc = include_directories('.') -astal_auth_headers = files('pam.h') +astal_auth_headers = files('auth.h') -install_headers('pam.h', subdir : 'astal') +install_headers('auth.h', subdir : 'astal') diff --git a/include/pam.h b/include/pam.h deleted file mode 100644 index bc1c28c..0000000 --- a/include/pam.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef ASTAL_AUTH_PAM_H -#define ASTAL_AUTH_PAM_H - -#include -#include - -G_BEGIN_DECLS - -#define ASTAL_AUTH_TYPE_PAM (astal_auth_pam_get_type()) - -G_DECLARE_FINAL_TYPE (AstalAuthPam, astal_auth_pam, ASTAL_AUTH, PAM, GObject) - -/** - * astal_auth_pam_set_username - * @self: a AstalAuthPam object - * @username: the new username - * - * Sets the username to be used for authentication. This must be set to - * before calling start_authenticate. - * Changing it afterwards has no effect on the authentication process. - * - * Defaults to the owner of the process. - * - */ -void astal_auth_pam_set_username(AstalAuthPam *self, const gchar *username); - -/** - * astal_auth_pam_get_username - * @self: a AstalAuthPam object - * - * Fetches the username from AsalAuthPam object. - * - * Returns: the username of the AsalAuthPam object. This string is - * owned by the object and must not be modified or freed. - */ -const gchar *astal_auth_pam_get_username(AstalAuthPam *self); - -/** - * astal_auth_pam_set_service - * @self: a AstalAuthPam object - * @service: the pam service used for authentication - * - * Sets the service to be used for authentication. This must be set to - * before calling start_authenticate. - * Changing it afterwards has no effect on the authentication process. - * - * Defaults to `astal-auth`. - * - */ -void astal_auth_pam_set_service(AstalAuthPam *self, const gchar *service); - -/** - * astal_auth_pam_get_service - * @self: a AstalAuthPam - * - * Fetches the service from AsalAuthPam object. - * - * Returns: the service of the AsalAuthPam object. This string is - * owned by the object and must not be modified or freed. - */ -const gchar *astal_auth_pam_get_service(AstalAuthPam *self); - - -/** - * astal_auth_pam_start_authentication: - * @self: a AstalAuthPam Object - * - * starts a new authentication process using the PAM (Pluggable Authentication Modules) system. - * Note that this will cancel an already running authentication process - * associated with this AstalAuthPam object. - */ -gboolean astal_auth_pam_start_authenticate(AstalAuthPam *self); - -/** - * astal_auth_pam_supply_secret - * @self: a AstalAuthPam Object - * @secret: (nullable) the secret to be provided to pam. Can be NULL. - * - * provides pam with a secret. This method must be called exactly once after a - * auth-* signal is emitted. - */ -void astal_auth_pam_supply_secret(AstalAuthPam *self, const gchar *secret); - -/** - * astal_auth_pam_authenticate: - * @password: the password to be authenticated - * @result_callback: (scope async) (closure user_data): a GAsyncReadyCallback - * to call when the request is satisfied - * @user_data: the data to pass to callback function - * - * Requests authentication of the provided password using the PAM (Pluggable Authentication Modules) system. - */ -gboolean astal_auth_pam_authenticate(const gchar *password, - GAsyncReadyCallback result_callback, - gpointer user_data); - -gssize astal_auth_pam_authenticate_finish(GAsyncResult *res, - GError **error); - -G_END_DECLS - -#endif // !ASTAL_AUTH_PAM_H diff --git a/meson.build b/meson.build index 34ab7c8..7d8fcd2 100644 --- a/meson.build +++ b/meson.build @@ -12,7 +12,8 @@ add_project_arguments( ['-Wno-pedantic'], language : 'c') -lib_so_version = 0 +version_split = meson.project_version().split('.') +lib_so_version = version_split[0] + '.' + version_split[1] pkg_config = import('pkgconfig') gnome = import('gnome') diff --git a/src/meson.build b/src/meson.build index 4c14897..6f41487 100644 --- a/src/meson.build +++ b/src/meson.build @@ -18,7 +18,7 @@ astal_auth_lib = library( install : true ) -pkg_config_name = 'astal-auth-' + lib_so_version.to_string() +pkg_config_name = 'astal-auth-' + lib_so_version if get_option('introspection') gir = gnome.generate_gir( @@ -29,7 +29,7 @@ if get_option('introspection') symbol_prefix : 'astal_auth', identifier_prefix : 'AstalAuth', includes : ['GObject-2.0', 'Gio-2.0'], - header : 'astal/astal-auth.h', + header : 'astal/auth.h', export_packages : pkg_config_name, install : true ) diff --git a/src/pam.c b/src/pam.c index de32531..760680e 100644 --- a/src/pam.c +++ b/src/pam.c @@ -1,4 +1,4 @@ -#include "pam.h" +#include "auth.h" #include #include #include -- cgit v1.2.3