+38
-6
@@ -18,24 +18,56 @@
|
|||||||
* audio, haptic and/or visual feedback to the user by triggering
|
* audio, haptic and/or visual feedback to the user by triggering
|
||||||
* feedback on a feedback daemon.
|
* feedback on a feedback daemon.
|
||||||
*
|
*
|
||||||
* One event can trigger several feedbacks at once (e.g. audio and
|
* One event can trigger multiple feedbacks at once (e.g. audio and
|
||||||
* haptic feedback). This is determined by the feedback theme in
|
* haptic feedback). This is determined by the feedback theme in
|
||||||
* use (which is not under the appliction's control) and the active
|
* use (which is not under the appliction's control) and the active
|
||||||
* feedback profile (see #lfb_set_feedback_profile()).
|
* feedback profile (see #lfb_set_feedback_profile()).
|
||||||
*
|
*
|
||||||
* After initializing the library feedback can be triggered like
|
* After initializing the library via #lfb_init() feedback can be
|
||||||
|
* triggered like:
|
||||||
*
|
*
|
||||||
* |[
|
* |[
|
||||||
* g_autoptr (GError) err = NULL;
|
* g_autoptr (GError) err = NULL;
|
||||||
* LpfEvent *event = lfb_event_new ("message-new-instant");
|
* LpfEvent *event = lfb_event_new ("message-new-instant");
|
||||||
* ret = lfb_event_trigger_feedback (event, &err);
|
* lfb_event_set_timeout (event, 0);
|
||||||
|
* if (!lfb_event_trigger_feedback (event, &err))
|
||||||
|
* g_warning ("Failed to trigger feedback: %s", err->message);
|
||||||
* ]|
|
* ]|
|
||||||
*
|
*
|
||||||
* When all feedback for this event has ended the #LfbEvent::feedback-ended
|
* When all feedback for this event has ended the #LfbEvent::feedback-ended
|
||||||
* signal is emitted. If you want to end the feedback ahead of time use
|
* signal is emitted. If you want to end the feedback ahead of time use
|
||||||
* #lfb_event_end_feedback ().
|
* #lfb_event_end_feedback ():
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* if (!lfb_event_end_feedback (event, &err))
|
||||||
|
* g_warning ("Failed to end feedback: %s", err->message);
|
||||||
|
* ]|
|
||||||
|
*
|
||||||
* Since these methods involve DBus calls there are asynchronous variants
|
* Since these methods involve DBus calls there are asynchronous variants
|
||||||
* available, see e.g. #lfb_event_trigger_feedback_async().
|
* available, e.g. #lfb_event_trigger_feedback_async():
|
||||||
|
*
|
||||||
|
* |[
|
||||||
|
* static void
|
||||||
|
* on_feedback_triggered (LfbEvent *event,
|
||||||
|
* GAsyncResult *res,
|
||||||
|
* gpointer unused)
|
||||||
|
* {
|
||||||
|
* g_autoptr (GError) err = NULL;
|
||||||
|
* if (!lfb_event_trigger_feedback_finish (event, res, &err)) {
|
||||||
|
* g_warning ("Failed to trigger feedback for %s: %s",
|
||||||
|
* lfb_event_get_event (event), err->message);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* static void
|
||||||
|
* my_function ()
|
||||||
|
* {
|
||||||
|
* LfbEvent *event = lfb_event_new ("message-new-instant");
|
||||||
|
* lfb_event_trigger_feedback_async (event, NULL,
|
||||||
|
* (GAsyncReadyCallback)on_feedback_triggered,
|
||||||
|
* NULL);
|
||||||
|
* }
|
||||||
|
* ]|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -250,7 +282,7 @@ lfb_event_class_init (LfbEventClass *klass)
|
|||||||
*
|
*
|
||||||
* How long feedback should be provided in milliseconds. The special value
|
* How long feedback should be provided in milliseconds. The special value
|
||||||
* %-1 uses the natural length of each feedback while %0 plays each feedback
|
* %-1 uses the natural length of each feedback while %0 plays each feedback
|
||||||
* in a loop until ended explicitly.
|
* in a loop until ended explicitly via e.g. #lfb_event_end_feedback().
|
||||||
*/
|
*/
|
||||||
props[PROP_TIMEOUT] =
|
props[PROP_TIMEOUT] =
|
||||||
g_param_spec_int (
|
g_param_spec_int (
|
||||||
|
|||||||
@@ -16,9 +16,11 @@
|
|||||||
*
|
*
|
||||||
* To use the library call #lfb_init() with the id of your application
|
* To use the library call #lfb_init() with the id of your application
|
||||||
* (usually the desktop file name without the .desktop extension).
|
* (usually the desktop file name without the .desktop extension).
|
||||||
* When done call #lfb_uninit() to free any resources.
|
* After initializing the library you can trigger feedback using
|
||||||
|
* #LfbEvent objects. When your application finishes call
|
||||||
|
* #lfb_uninit() to free any resources:
|
||||||
*
|
*
|
||||||
* |[
|
* |[<!-- language="C" -->
|
||||||
* #define LIBFEEDBACK_USE_UNSTABLE_API
|
* #define LIBFEEDBACK_USE_UNSTABLE_API
|
||||||
* #include <libfeedback.h>
|
* #include <libfeedback.h>
|
||||||
*
|
*
|
||||||
@@ -28,9 +30,7 @@
|
|||||||
* if (lfb_init ("com.example.appid", &err)) {
|
* if (lfb_init ("com.example.appid", &err)) {
|
||||||
* g_error ("%s", err->message);
|
* g_error ("%s", err->message);
|
||||||
* }
|
* }
|
||||||
* // run your application, emit events
|
* ...
|
||||||
* // ...
|
|
||||||
* // when done:
|
|
||||||
* lfb_uninit ();
|
* lfb_uninit ();
|
||||||
* return 0;
|
* return 0;
|
||||||
* }
|
* }
|
||||||
|
|||||||
Reference in New Issue
Block a user