From: Takashi Sakamoto Date: Sun, 9 Feb 2020 03:20:53 +0000 (+0900) Subject: timer: user_instance: add class virtual method to handle disconnection of the attache... X-Git-Tag: v0.1.0~325 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=2a16d067919d1b36ba6fc04a488c3bffa931943f;p=alsa-gobject.git timer: user_instance: add class virtual method to handle disconnection of the attached timer device Signed-off-by: Takashi Sakamoto --- diff --git a/src/timer/user-instance.c b/src/timer/user-instance.c index 8e6e845..6a0da62 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -79,7 +79,7 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass g_signal_new("handle-disconnection", G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_LAST, - 0, + G_STRUCT_OFFSET(ALSATimerUserInstanceClass, handle_disconnection), NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE, 0); diff --git a/src/timer/user-instance.h b/src/timer/user-instance.h index 5d83933..c271084 100644 --- a/src/timer/user-instance.h +++ b/src/timer/user-instance.h @@ -57,6 +57,17 @@ struct _ALSATimerUserInstanceClass { */ void (*handle_event)(ALSATimerUserInstance *self, const ALSATimerEventData *event_data); + + /** + * ALSATimerUserInstanceClass::handle_disconnection: + * @self: A #ALSATimerUserInstance. + * + * When the attached timer device is not available anymore due to unbinding + * driver or hot unplugging, this signal is emit. The owner of this object + * should call g_object_free() as quickly as possible to release ALSA timer + * character device. + */ + void (*handle_disconnection)(ALSATimerUserInstance *self); }; GType alsatimer_user_instance_get_type() G_GNUC_CONST; diff --git a/tests/alsatimer-user-instance b/tests/alsatimer-user-instance index f74fa21..83df59d 100644 --- a/tests/alsatimer-user-instance +++ b/tests/alsatimer-user-instance @@ -21,6 +21,7 @@ methods = ( 'get_status', 'create_source', 'do_handle_event', + 'do_handle_disconnection', ) signals = ( 'handle-event',