Class

LfbEvent

since: 0.0

Description [src]

final class Lfb.Event : GObject.Object
{
  /* No available fields */
}

An event triggering feedback to the user

LfbEvent represents an event that should trigger audio, haptic and/or visual feedback to the user by triggering feedback on a feedback daemon. Valid event names are specified in the Event naming specification.

One event can trigger multiple feedbacks at once (e.g. audio and haptic feedback). This is determined by the feedback theme in use (which is not under the appliction’s control) and the active feedback profile (see lfb_set_feedback_profile().

After initializing the library via lfb_init() feedback can be triggered like:

  g_autoptr (GError) err = NULL;
  LfbEvent *event = lfb_event_new ("message-new-instant");
  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 signal is emitted. If you want to end the feedback ahead of time use 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 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);
  }

Available since: 0.0

Hierarchy

hierarchy this LfbEvent ancestor_0 GObject ancestor_0--this

Ancestors

Constructors

lfb_event_new

Creates a new LfbEvent based on the given event name. See LfbEvent:event for details.

since: 0.0

Instance methods

lfb_event_end_feedback

Tells the feedback server to end all feedback for the given event as soon as possible.

since: 0.0

lfb_event_end_feedback_async

Tells the feedback server to end all feedback for the given event as soon as possible.

since: 0.0

lfb_event_end_feedback_finish

Finish an async operation started by lfb_event_end_feedback_async. You must call this function in the callback to free memory and receive any errors which occurred.

since: 0.0

lfb_event_get_app_id

Returns the app-id for this event. If no app-id has been explicitly set, NULL is returned. The event uses the app-id returned by lfb_get_app_id() in this case.

since: 0.0

lfb_event_get_end_reason

Get the reason why the feadback ended.

since: 0.0

lfb_event_get_event

Get the event’s name according to the event naming spec.

since: 0.0

lfb_event_get_feedback_profile

Gets the set feedback profile. If no profile was set it returns NULL. The event uses the system wide profile in this case.

since: 0.0

lfb_event_get_important

Gets the set feedback profile. If no profile was set it returns NULL. The event uses the system wide profile in this case.

since: 0.0

lfb_event_get_state

Get the current event state (e.g. if triggered feeedback is currently running.

since: 0.0

lfb_event_get_timeout

Get the currently set timeout.

since: 0.0

lfb_event_set_app_id

Tells the feedback server to use the given application id for this event when it is submitted. The server might ignore this request. This can be used by notification daemons to honor per application settings automatically.

since: 0.0

lfb_event_set_feedback_profile

Tells the feedback server to use the given feedback profile for this event when it is submitted. The server might ignore this request. Valid profile names and their ‘noisiness’ are specified in the Feedback theme specification.

since: 0.0

lfb_event_set_important

Tells the feedback server that the sender deems this to be an important event. A feedback server might allow the sender to override the current feedback level when this is set.

since: 0.0

lfb_event_set_timeout

Tells the feedback server to end feedack after #timeout seconds. The value -1 indicates to not set a timeout and let feedbacks stop on their own while 0 indicates to loop all feedbacks endlessly. They must be stopped via lfb_event_end_feedback() in this case.

since: 0.0

lfb_event_trigger_feedback

Tells the feedback server to provide proper feedback for the give event to the user.

since: 0.0

lfb_event_trigger_feedback_async

Tells the feedback server to provide proper feedback for the give event to the user. This is the sync version of lfb_event_trigger_feedback().

since: 0.0

lfb_event_trigger_feedback_finish

Finish an async operation started by lfb_event_trigger_feedback_async(). You must call this function in the callback to free memory and receive any errors which occurred.

since: 0.0

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Lfb.Event:app-id

The application id to use for the event. lfb_event_set_feedback_profile() for details.

since: 0.0

Lfb.Event:end-reason
No description available.

since: 0.0

Lfb.Event:event

The type of event from the Event naming spec, e.g. ‘message-new-instant’.

since: 0.0

Lfb.Event:feedback-profile

The name of the feedback profile to use for this event. See lfb_event_set_feedback_profile() for details.

since: 0.0

Lfb.Event:important

Whether to flag this event as important. LfbEvent.set_imporant for details.

since: 0.0

Lfb.Event:state
No description available.

since: 0.0

Lfb.Event:timeout

How long feedback should be provided in seconds. The special value %-1 uses the natural length of each feedback while 0 plays each feedback in a loop until ended explicitly via e.g. lfb_event_end_feedback().

since: 0.0

Signals

Lfb.Event::feedback-ended

Emitted when all feedbacks triggered by the event have ended.

since: 0.0

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

unstable since: 2.0

Class structure

struct LfbEventClass {
  GObjectClass parent_class;
  
}
No description available.
Class members
parent_class: GObjectClass
No description available.