libfprint/SOURCES/0153-Prefix-internal-properties-signals-with-fpi-and-anno.patch
2021-09-09 20:12:48 +00:00

360 lines
14 KiB
Diff

From 56edf22163089dba9314e4dd48449829a1110b40 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Wed, 18 Dec 2019 12:03:42 +0100
Subject: [PATCH 153/181] Prefix internal properties/signals with fpi- and
annotate them
We prefixed them with fp- which is not as obvious as fpi-. Also,
explicitly mark them as private and to be skipped in the GObject
Introspection annotatinos.
Warning: FPrint: (Signal)fp-image-device-state-changed: argument object: Unresolved type: 'FpiImageDeviceState'
---
libfprint/drivers/synaptics/synaptics.c | 8 +++----
libfprint/drivers/upekts.c | 4 ++--
libfprint/fp-context.c | 8 +++----
libfprint/fp-device.c | 29 +++++++++++++++++++++----
libfprint/fp-image-device.c | 20 +++++++++++++++--
libfprint/fp-print.c | 22 +++++++++++++++----
libfprint/fpi-image-device.c | 12 +++++-----
libfprint/fpi-print.c | 2 +-
tests/test-fpi-device.c | 6 ++---
9 files changed, 81 insertions(+), 30 deletions(-)
diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c
index af4a2fd..2aac75e 100644
--- a/libfprint/drivers/synaptics/synaptics.c
+++ b/libfprint/drivers/synaptics/synaptics.c
@@ -519,7 +519,7 @@ list_msg_cb (FpiDeviceSynaptics *self,
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
- g_object_set (print, "fp-data", data, NULL);
+ g_object_set (print, "fpi-data", data, NULL);
g_object_set (print, "description", get_enroll_templates_resp->templates[n].user_id, NULL);
/* The format has 24 bytes at the start and some dashes in the right places */
@@ -670,7 +670,7 @@ verify (FpDevice *device)
fpi_device_get_verify_data (device, &print);
- g_object_get (print, "fp-data", &data, NULL);
+ g_object_get (print, "fpi-data", &data, NULL);
g_debug ("data is %p", data);
if (!parse_print_data (data, &finger, &user_id, &user_id_len))
{
@@ -858,7 +858,7 @@ enroll (FpDevice *device)
fpi_print_set_type (print, FPI_PRINT_RAW);
fpi_print_set_device_stored (print, TRUE);
- g_object_set (print, "fp-data", data, NULL);
+ g_object_set (print, "fpi-data", data, NULL);
g_object_set (print, "description", user_id, NULL);
g_debug ("user_id: %s, finger: %d", user_id, finger);
@@ -927,7 +927,7 @@ delete_print (FpDevice *device)
fpi_device_get_delete_data (device, &print);
- g_object_get (print, "fp-data", &data, NULL);
+ g_object_get (print, "fpi-data", &data, NULL);
g_debug ("data is %p", data);
if (!parse_print_data (data, &finger, &user_id, &user_id_len))
{
diff --git a/libfprint/drivers/upekts.c b/libfprint/drivers/upekts.c
index 6ce8136..16534d3 100644
--- a/libfprint/drivers/upekts.c
+++ b/libfprint/drivers/upekts.c
@@ -1126,7 +1126,7 @@ e_handle_resp02 (FpDevice *dev, unsigned char *data,
data_len - sizeof (scan_comp),
1);
- g_object_set (print, "fp-data", fp_data, NULL);
+ g_object_set (print, "fpi-data", fp_data, NULL);
g_object_ref (print);
}
@@ -1293,7 +1293,7 @@ verify_start_sm_run_state (FpiSsm *ssm, FpDevice *dev)
case VERIFY_INIT:
fpi_device_get_verify_data (dev, &print);
- g_object_get (dev, "fp-data", &fp_data, NULL);
+ g_object_get (dev, "fpi-data", &fp_data, NULL);
data = g_variant_get_fixed_array (fp_data, &data_len, 1);
diff --git a/libfprint/fp-context.c b/libfprint/fp-context.c
index f64968d..0e7c17f 100644
--- a/libfprint/fp-context.c
+++ b/libfprint/fp-context.c
@@ -170,8 +170,8 @@ usb_device_added_cb (FpContext *self, GUsbDevice *device, GUsbContext *usb_ctx)
priv->cancellable,
async_device_init_done_cb,
self,
- "fp-usb-device", device,
- "fp-driver-data", found_entry->driver_data,
+ "fpi-usb-device", device,
+ "fpi-driver-data", found_entry->driver_data,
NULL);
}
@@ -373,8 +373,8 @@ fp_context_enumerate (FpContext *context)
priv->cancellable,
async_device_init_done_cb,
context,
- "fp-environ", val,
- "fp-driver-data", entry->driver_data,
+ "fpi-environ", val,
+ "fpi-driver-data", entry->driver_data,
NULL);
g_debug ("created");
}
diff --git a/libfprint/fp-device.c b/libfprint/fp-device.c
index 8041a86..116f9f8 100644
--- a/libfprint/fp-device.c
+++ b/libfprint/fp-device.c
@@ -342,22 +342,43 @@ fp_device_class_init (FpDeviceClass *klass)
"Wether the device is open or not", FALSE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
+ /**
+ * FpDevice::fpi-environ: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_ENVIRON] =
- g_param_spec_string ("fp-environ",
+ g_param_spec_string ("fpi-environ",
"Virtual Environment",
"Private: The environment variable for the virtual device",
NULL,
G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+ /**
+ * FpDevice::fpi-usb-device: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_USB_DEVICE] =
- g_param_spec_object ("fp-usb-device",
+ g_param_spec_object ("fpi-usb-device",
"USB Device",
"Private: The USB device for the device",
G_USB_TYPE_DEVICE,
G_PARAM_STATIC_STRINGS | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
+ /**
+ * FpDevice::fpi-driver-data: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_DRIVER_DATA] =
- g_param_spec_uint64 ("fp-driver-data",
+ g_param_spec_uint64 ("fpi-driver-data",
"Driver Data",
"Private: The driver data from the ID table entry",
0,
@@ -737,7 +758,7 @@ fp_device_enroll (FpDevice *device,
return;
}
- g_object_get (template_print, "fp-type", &print_type, NULL);
+ g_object_get (template_print, "fpi-type", &print_type, NULL);
if (print_type != FPI_PRINT_UNDEFINED)
{
g_warning ("Passed print template must be newly created and blank!");
diff --git a/libfprint/fp-image-device.c b/libfprint/fp-image-device.c
index 9e6c375..20e181e 100644
--- a/libfprint/fp-image-device.c
+++ b/libfprint/fp-image-device.c
@@ -267,16 +267,32 @@ fp_image_device_class_init (FpImageDeviceClass *klass)
klass->activate = fp_image_device_default_activate;
klass->deactivate = fp_image_device_default_deactivate;
+ /**
+ * FpImageDevice::fpi-image-device-state: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_STATE] =
- g_param_spec_enum ("fp-image-device-state",
+ g_param_spec_enum ("fpi-image-device-state",
"Image Device State",
"Private: The state of the image device",
FPI_TYPE_IMAGE_DEVICE_STATE,
FPI_IMAGE_DEVICE_STATE_INACTIVE,
G_PARAM_STATIC_STRINGS | G_PARAM_READABLE);
+ /**
+ * FpImageDevice::fpi-image-device-state-changed: (skip)
+ * @image_device: A #FpImageDevice
+ * @new_state: The new state of the device
+ *
+ * This signal is only for internal purposes.
+ *
+ * Stability: private
+ */
signals[FPI_STATE_CHANGED] =
- g_signal_new ("fp-image-device-state-changed",
+ g_signal_new ("fpi-image-device-state-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (FpImageDeviceClass, change_state),
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
index dd45b95..34139ce 100644
--- a/libfprint/fp-print.c
+++ b/libfprint/fp-print.c
@@ -268,16 +268,30 @@ fp_print_class_init (FpPrintClass *klass)
G_TYPE_DATE,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE);
+ /**
+ * FpPrint::fpi-type: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_TYPE] =
- g_param_spec_enum ("fp-type",
+ g_param_spec_enum ("fpi-type",
"Type",
"Private: The type of the print data",
FPI_TYPE_PRINT_TYPE,
FPI_PRINT_RAW,
G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY);
+ /**
+ * FpPrint::fpi-data: (skip)
+ *
+ * This property is only for internal purposes.
+ *
+ * Stability: private
+ */
properties[PROP_FPI_DATA] =
- g_param_spec_variant ("fp-data",
+ g_param_spec_variant ("fpi-data",
"Raw Data",
"The raw data for internal use only",
G_VARIANT_TYPE_ANY,
@@ -846,11 +860,11 @@ fp_print_deserialize (const guchar *data,
g_autoptr(GVariant) fp_data = g_variant_get_child_value (print_data, 0);
result = g_object_new (FP_TYPE_PRINT,
- "fp-type", type,
+ "fpi-type", type,
"driver", driver,
"device-id", device_id,
"device-stored", device_stored,
- "fp-data", fp_data,
+ "fpi-data", fp_data,
NULL);
}
else
diff --git a/libfprint/fpi-image-device.c b/libfprint/fpi-image-device.c
index e03d60c..975e3a1 100644
--- a/libfprint/fpi-image-device.c
+++ b/libfprint/fpi-image-device.c
@@ -55,7 +55,7 @@ fpi_image_device_activate (FpImageDevice *self)
/* We don't have a neutral ACTIVE state, but we always will
* go into WAIT_FINGER_ON afterwards. */
priv->state = FPI_IMAGE_DEVICE_STATE_AWAIT_FINGER_ON;
- g_object_notify (G_OBJECT (self), "fp-image-device-state");
+ g_object_notify (G_OBJECT (self), "fpi-image-device-state");
/* We might have been waiting for deactivation to finish before
* starting the next operation. */
@@ -83,7 +83,7 @@ fpi_image_device_deactivate (FpImageDevice *self)
g_warning ("Deactivating image device while waiting for finger, this should not happen.");
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
- g_object_notify (G_OBJECT (self), "fp-image-device-state");
+ g_object_notify (G_OBJECT (self), "fpi-image-device-state");
fp_dbg ("Deactivating image device\n");
cls->deactivate (self);
@@ -106,8 +106,8 @@ fp_image_device_change_state (FpImageDevice *self, FpiImageDeviceState state)
fp_dbg ("Image device internal state change from %d to %d\n", priv->state, state);
priv->state = state;
- g_object_notify (G_OBJECT (self), "fp-image-device-state");
- g_signal_emit_by_name (self, "fp-image-device-state-changed", priv->state);
+ g_object_notify (G_OBJECT (self), "fpi-image-device-state");
+ g_signal_emit_by_name (self, "fpi-image-device-state-changed", priv->state);
}
static void
@@ -563,7 +563,7 @@ fpi_image_device_open_complete (FpImageDevice *self, GError *error)
g_debug ("Image device open completed");
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
- g_object_notify (G_OBJECT (self), "fp-image-device-state");
+ g_object_notify (G_OBJECT (self), "fpi-image-device-state");
fpi_device_open_complete (FP_DEVICE (self), error);
}
@@ -589,7 +589,7 @@ fpi_image_device_close_complete (FpImageDevice *self, GError *error)
g_return_if_fail (action == FPI_DEVICE_ACTION_CLOSE);
priv->state = FPI_IMAGE_DEVICE_STATE_INACTIVE;
- g_object_notify (G_OBJECT (self), "fp-image-device-state");
+ g_object_notify (G_OBJECT (self), "fpi-image-device-state");
fpi_device_close_complete (FP_DEVICE (self), error);
}
diff --git a/libfprint/fpi-print.c b/libfprint/fpi-print.c
index 7a5e1e2..4e3ed03 100644
--- a/libfprint/fpi-print.c
+++ b/libfprint/fpi-print.c
@@ -75,7 +75,7 @@ fpi_print_set_type (FpPrint *print,
g_assert_null (print->prints);
print->prints = g_ptr_array_new_with_free_func (g_free);
}
- g_object_notify (G_OBJECT (print), "fp-type");
+ g_object_notify (G_OBJECT (print), "fpi-type");
}
/**
diff --git a/tests/test-fpi-device.c b/tests/test-fpi-device.c
index 398407a..3fa800c 100644
--- a/tests/test-fpi-device.c
+++ b/tests/test-fpi-device.c
@@ -240,7 +240,7 @@ test_driver_get_usb_device (void)
g_autoptr(FpDevice) device = NULL;
dev_class->type = FP_DEVICE_TYPE_USB;
- device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fp-usb-device", NULL);
+ device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fpi-usb-device", NULL);
g_assert_null (fpi_device_get_usb_device (device));
g_clear_object (&device);
@@ -259,7 +259,7 @@ test_driver_get_virtual_env (void)
g_autoptr(FpDevice) device = NULL;
dev_class->type = FP_DEVICE_TYPE_VIRTUAL;
- device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fp-environ", "TEST_VIRTUAL_ENV_GETTER", NULL);
+ device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fpi-environ", "TEST_VIRTUAL_ENV_GETTER", NULL);
g_assert_cmpstr (fpi_device_get_virtual_env (device), ==, "TEST_VIRTUAL_ENV_GETTER");
g_clear_object (&device);
@@ -278,7 +278,7 @@ test_driver_get_driver_data (void)
guint64 driver_data;
driver_data = g_random_int ();
- device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fp-driver-data", driver_data, NULL);
+ device = g_object_new (FPI_TYPE_DEVICE_FAKE, "fpi-driver-data", driver_data, NULL);
g_assert_cmpuint (fpi_device_get_driver_data (device), ==, driver_data);
}
--
2.24.1