Use g_error() when library is not initalized

This makes sure it still works when asserts are disabled.
This commit is contained in:
Guido Günther
2022-10-12 10:19:03 +02:00
parent 8df5d1606e
commit dafb18678b
2 changed files with 12 additions and 24 deletions
+8 -16
View File
@@ -415,10 +415,8 @@ lfb_event_trigger_feedback (LfbEvent *self, GError **error)
g_return_val_if_fail (LFB_IS_EVENT (self), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before triggering events");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before triggering events.");
proxy = _lfb_get_proxy ();
g_return_val_if_fail (G_IS_DBUS_PROXY (proxy), FALSE);
@@ -466,10 +464,8 @@ lfb_event_trigger_feedback_async (LfbEvent *self,
LfbGdbusFeedback *proxy;
g_return_if_fail (LFB_IS_EVENT (self));
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before triggering events");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before triggering events.");
proxy = _lfb_get_proxy ();
g_return_if_fail (LFB_GDBUS_IS_FEEDBACK (proxy));
@@ -537,10 +533,8 @@ lfb_event_end_feedback (LfbEvent *self, GError **error)
g_return_val_if_fail (LFB_IS_EVENT (self), FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before ending events");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before ending events.");
proxy = _lfb_get_proxy ();
g_return_val_if_fail (LFB_GDBUS_IS_FEEDBACK (proxy), FALSE);
@@ -593,10 +587,8 @@ lfb_event_end_feedback_async (LfbEvent *self,
LfbGdbusFeedback *proxy;
g_return_if_fail (LFB_IS_EVENT (self));
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before ending events");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before ending events.");
proxy = _lfb_get_proxy ();
g_return_if_fail (LFB_GDBUS_IS_FEEDBACK (proxy));
+4 -8
View File
@@ -192,10 +192,8 @@ lfb_get_feedback_profile (void)
{
LfbGdbusFeedback *proxy;
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before getting the profile");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before ending events.");
proxy = _lfb_get_proxy ();
g_return_val_if_fail (LFB_GDBUS_IS_FEEDBACK (proxy), NULL);
@@ -218,10 +216,8 @@ lfb_set_feedback_profile (const gchar *profile)
{
LfbGdbusFeedback *proxy;
if (!lfb_is_initted ()) {
g_warning ("you must call lfb_init() before setting the profile");
g_assert_not_reached ();
}
if (!lfb_is_initted ())
g_error ("You must call lfb_init() before ending events.");
proxy = _lfb_get_proxy ();
g_return_if_fail (LFB_GDBUS_IS_FEEDBACK (proxy));