From: Takashi Sakamoto Date: Sun, 9 Feb 2020 03:20:53 +0000 (+0900) Subject: timer: user_instance: add GObject signal to handle disconnection of the attached... X-Git-Tag: v0.1.0~326 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=ce1da13d3a85198570d9c14d253211400fc952a8;p=alsa-gobject.git timer: user_instance: add GObject signal 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 4f12948..8e6e845 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -27,6 +27,7 @@ typedef struct { enum timer_user_instance_sig_type { TIMER_USER_INSTANCE_SIG_HANDLE_EVENT = 0, + TIMER_USER_INSTANCE_SIG_HANDLE_DISCONNECTION, TIMER_USER_INSTANCE_SIG_COUNT, }; static guint timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_COUNT] = { 0 }; @@ -64,6 +65,24 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, ALSATIMER_TYPE_EVENT_DATA); + + /** + * ALSATimerUserInstance::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. + */ + timer_user_instance_sigs[TIMER_USER_INSTANCE_SIG_HANDLE_DISCONNECTION] = + g_signal_new("handle-disconnection", + G_OBJECT_CLASS_TYPE(klass), + G_SIGNAL_RUN_LAST, + 0, + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0, G_TYPE_NONE, 0); } static void alsatimer_user_instance_init(ALSATimerUserInstance *self) diff --git a/tests/alsatimer-user-instance b/tests/alsatimer-user-instance index 3140cea..f74fa21 100644 --- a/tests/alsatimer-user-instance +++ b/tests/alsatimer-user-instance @@ -24,6 +24,7 @@ methods = ( ) signals = ( 'handle-event', + 'handle-disconnection', ) if not test(target, props, methods, signals):