mirror of
https://gitlab.com/mishakmak/pam-fprint-grosshack.git
synced 2026-04-08 20:03:34 +02:00
device: Use meson to generate fprint device permission flags
This commit is contained in:
committed by
Benjamin Berg
parent
e59f3cbc4f
commit
4c78012103
44
src/device.c
44
src/device.c
@ -30,6 +30,7 @@
|
||||
#include <errno.h>
|
||||
|
||||
#include "fprintd.h"
|
||||
#include "fprintd-enums.h"
|
||||
#include "storage.h"
|
||||
|
||||
static const char *FINGERS_NAMES[] = {
|
||||
@ -68,13 +69,6 @@ typedef enum {
|
||||
STATE_IGNORED,
|
||||
} FprintDeviceClaimState;
|
||||
|
||||
typedef enum {
|
||||
FPRINT_DEVICE_PERMISSION_NONE = 0,
|
||||
FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 0),
|
||||
FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 1),
|
||||
FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 2),
|
||||
} FprintDevicePermission;
|
||||
|
||||
typedef struct {
|
||||
/* current method invocation */
|
||||
GDBusMethodInvocation *invocation;
|
||||
@ -135,39 +129,6 @@ enum fprint_device_signals {
|
||||
static guint32 last_id = ~0;
|
||||
static guint signals[NUM_SIGNALS] = { 0, };
|
||||
|
||||
static GType
|
||||
fprint_device_permission_get_type (void)
|
||||
{
|
||||
static volatile gsize define_type_id = 0;
|
||||
|
||||
if (g_once_init_enter (&define_type_id)) {
|
||||
static const GFlagsValue values[] = {
|
||||
{
|
||||
FPRINT_DEVICE_PERMISSION_ENROLL,
|
||||
"FPRINT_DEVICE_PERMISSION_ENROLL",
|
||||
"net.reactivated.fprint.device.enroll"
|
||||
},
|
||||
{
|
||||
FPRINT_DEVICE_PERMISSION_SETUSERNAME,
|
||||
"FPRINT_DEVICE_PERMISSION_SETUSERNAME",
|
||||
"net.reactivated.fprint.device.setusername"
|
||||
},
|
||||
{
|
||||
FPRINT_DEVICE_PERMISSION_VERIFY,
|
||||
"FPRINT_DEVICE_PERMISSION_VERIFY",
|
||||
"net.reactivated.fprint.device.verify"
|
||||
},
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
GType type_id = g_flags_register_static (
|
||||
"FprintDevicePermission", values);
|
||||
g_once_init_leave (&define_type_id, type_id);
|
||||
}
|
||||
|
||||
return define_type_id;
|
||||
}
|
||||
|
||||
static void session_data_free(SessionData *session)
|
||||
{
|
||||
g_clear_pointer(&session->sender, g_free);
|
||||
@ -525,8 +486,7 @@ fprint_device_check_polkit_for_permissions (FprintDevice *rdev,
|
||||
if (permissions == FPRINT_DEVICE_PERMISSION_NONE)
|
||||
return TRUE;
|
||||
|
||||
permission_flags =
|
||||
g_type_class_ref (fprint_device_permission_get_type ());
|
||||
permission_flags = g_type_class_ref (FPRINT_TYPE_DEVICE_PERMISSION);
|
||||
|
||||
for (i = 0; i < permission_flags->n_values; ++i) {
|
||||
GFlagsValue *value = &permission_flags->values[i];
|
||||
|
||||
@ -45,6 +45,13 @@ typedef enum {
|
||||
FPRINT_ERROR_NO_SUCH_DEVICE, /* device does not exist */
|
||||
} FprintError;
|
||||
|
||||
typedef enum {
|
||||
FPRINT_DEVICE_PERMISSION_NONE = 0,
|
||||
FPRINT_DEVICE_PERMISSION_ENROLL = (1 << 0), /*< nick=net.reactivated.fprint.device.enroll >*/
|
||||
FPRINT_DEVICE_PERMISSION_SETUSERNAME = (1 << 1), /*< nick=net.reactivated.fprint.device.setusername >*/
|
||||
FPRINT_DEVICE_PERMISSION_VERIFY = (1 << 2), /*< nick=net.reactivated.fprint.device.verify >*/
|
||||
} FprintDevicePermission;
|
||||
|
||||
/* Manager */
|
||||
#define FPRINT_TYPE_MANAGER (fprint_manager_get_type())
|
||||
G_DECLARE_FINAL_TYPE (FprintManager, fprint_manager, FPRINT, MANAGER, GObject)
|
||||
|
||||
@ -22,11 +22,16 @@ fprintd_dbus_sources = gnome.gdbus_codegen('fprintd-dbus',
|
||||
object_manager: true,
|
||||
)
|
||||
|
||||
fprintd_enum_files = gnome.mkenums_simple('fprintd-enums',
|
||||
sources: 'fprintd.h',
|
||||
)
|
||||
|
||||
fprintd_deps = declare_dependency(
|
||||
include_directories: [
|
||||
include_directories('..'),
|
||||
],
|
||||
sources: [
|
||||
fprintd_enum_files,
|
||||
fprintd_dbus_sources,
|
||||
],
|
||||
dependencies: [
|
||||
|
||||
Reference in New Issue
Block a user