Commit 94ef60f7 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

fbd-feedback-base: Add fbd_feedback_is_available ()

This allows to check if a feedback type is available
at all.
parent f950cfc3
......@@ -227,3 +227,28 @@ fbd_feedback_base_done (FbdFeedbackBase *self)
priv->ended = TRUE;
g_signal_emit (self, signals[SIGNAL_ENDED], 0);
}
/**
* fbd_feedback_available:
* @self: The feedback
*
* Whether this feedback type is available at all. This can be %FALSE e.g.
* due to missing hardware.
*
* Returns: %FALSE if the feedback type is not available at all %TRUE if unsure
* or available.
*/
gboolean
fbd_feedback_is_available (FbdFeedbackBase *self)
{
FbdFeedbackBaseClass *klass;
g_return_val_if_fail (FBD_IS_FEEDBACK_BASE (self), FALSE);
klass = FBD_FEEDBACK_BASE_GET_CLASS (self);
if (klass->is_available)
return klass->is_available (self);
else
return TRUE;
}
......@@ -17,8 +17,9 @@ struct _FbdFeedbackBaseClass
{
GObjectClass parent_class;
void (*run) (FbdFeedbackBase *self);
void (*end) (FbdFeedbackBase *self);
void (*run) (FbdFeedbackBase *self);
void (*end) (FbdFeedbackBase *self);
gboolean (*is_available) (FbdFeedbackBase *self);
};
......@@ -27,5 +28,6 @@ void fbd_feedback_run (FbdFeedbackBase *self);
void fbd_feedback_end (FbdFeedbackBase *self);
gboolean fbd_feedback_get_ended (FbdFeedbackBase *self);
void fbd_feedback_base_done (FbdFeedbackBase *self);
gboolean fbd_feedback_is_available (FbdFeedbackBase *self);
G_END_DECLS
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment