From: Takashi Sakamoto Date: Sun, 9 Feb 2020 03:20:53 +0000 (+0900) Subject: timer: user_instance: add virtual method to handle event X-Git-Tag: v0.1.0~328 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=aa78b360f576b4d4b76485664170cace2cf2afac;p=alsa-gobject.git timer: user_instance: add virtual method to handle event Signed-off-by: Takashi Sakamoto --- diff --git a/src/timer/user-instance.c b/src/timer/user-instance.c index 0bbc947..6ec4ce5 100644 --- a/src/timer/user-instance.c +++ b/src/timer/user-instance.c @@ -58,7 +58,7 @@ static void alsatimer_user_instance_class_init(ALSATimerUserInstanceClass *klass g_signal_new("handle-event", G_OBJECT_CLASS_TYPE(klass), G_SIGNAL_RUN_LAST, - 0, + G_STRUCT_OFFSET(ALSATimerUserInstanceClass, handle_event), NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, ALSATIMER_TYPE_EVENT_DATA); diff --git a/src/timer/user-instance.h b/src/timer/user-instance.h index a4cc9bf..1448575 100644 --- a/src/timer/user-instance.h +++ b/src/timer/user-instance.h @@ -47,6 +47,16 @@ struct _ALSATimerUserInstance { struct _ALSATimerUserInstanceClass { GObjectClass parent_class; + + /** + * ALSATimerUserInstanceClass::handle_event: + * @self: A #ALSATimerUserInstance. + * @event_data: (transfer none): An object derived from #ALSATimerEventData. + * + * When event occurs, this signal is emit. + */ + void (*handle_event)(ALSATimerUserInstance *self, + const ALSATimerEventData *event_data); }; GType alsatimer_user_instance_get_type() G_GNUC_CONST; diff --git a/tests/alsatimer-user-instance b/tests/alsatimer-user-instance index b369f53..3140cea 100644 --- a/tests/alsatimer-user-instance +++ b/tests/alsatimer-user-instance @@ -20,6 +20,7 @@ methods = ( 'set_params', 'get_status', 'create_source', + 'do_handle_event', ) signals = ( 'handle-event',