fprintd: Use GDBus codegen based implementation

Fprintd is dependent on the deprecated dbus-glib, also this doesn't provide
various features we can take advantage of, like the ones for async
authentication mechanism.

So, remove all the dbus-glib dependencies and simplify the code, but without
any further refactor, and keeping everything as it used to work, while this
will give room for further improvements in subsequent commits.

Internally, we just use dbus-codegen to generate the skeletons, and we
use the generated FprintdDBusManager with composition, while we
implement the device skeleton interface in FprintDevice, so that we
don't have to use it as a proxy, and keep being closer to what it used
to be with dbus-glib.

Fixes: #61
This commit is contained in:
Marco Trevisan (Treviño)
2020-02-03 20:29:56 +01:00
committed by Benjamin Berg
parent e224913b80
commit 93bad82540
15 changed files with 750 additions and 588 deletions

View File

@ -20,19 +20,19 @@
#pragma once
#include <glib.h>
#include <dbus/dbus-glib.h>
#include <gio/gio.h>
#include <fprint.h>
#include "fprintd-dbus.h"
/* General */
#define TIMEOUT 30
#define FPRINT_SERVICE_NAME "net.reactivated.Fprint"
#define FPRINT_SERVICE_PATH "/net/reactivated/Fprint"
/* Errors */
GQuark fprint_error_quark(void);
GType fprint_error_get_type(void);
#define FPRINT_ERROR fprint_error_quark()
#define FPRINT_TYPE_ERROR fprint_error_get_type()
#define FPRINT_ERROR_DBUS_INTERFACE "net.reactivated.Fprint.Error"
typedef enum {
FPRINT_ERROR_CLAIM_DEVICE, /* developer didn't claim the device */
@ -53,23 +53,18 @@ struct _FprintManager {
GObject parent;
};
FprintManager *fprint_manager_new(gboolean no_timeout);
FprintManager *fprint_manager_new (GDBusConnection *connection, gboolean no_timeout);
/* Device */
#define FPRINT_TYPE_DEVICE (fprint_device_get_type())
G_DECLARE_FINAL_TYPE (FprintDevice, fprint_device, FPRINT, DEVICE, GObject)
G_DECLARE_FINAL_TYPE (FprintDevice, fprint_device, FPRINT, DEVICE,
FprintDBusDeviceSkeleton)
struct _FprintDevice {
GObject parent;
FprintDBusDeviceSkeleton parent;
};
FprintDevice *fprint_device_new(FpDevice *dev);
guint32 _fprint_device_get_id(FprintDevice *rdev);
/* Print */
/* TODO */
/* Binding data included in main.c through server-bindings.h which individual
* class implementations need to access.
*/
extern const DBusGObjectInfo dbus_glib_fprint_manager_object_info;
extern const DBusGObjectInfo dbus_glib_fprint_device_object_info;