Merge branch 'no-fb' into 'main'
cli: Inform user when no feedback was found Closes #76 See merge request Librem5/feedbackd!130
This commit is contained in:
+12
-9
@@ -37,7 +37,7 @@ on_watch_expired (gpointer unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_feedback_ended (LfbEvent *event, int* data)
|
on_feedback_ended (LfbEvent *event, int *data)
|
||||||
{
|
{
|
||||||
g_return_if_fail (LFB_IS_EVENT (event));
|
g_return_if_fail (LFB_IS_EVENT (event));
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ on_feedback_ended (LfbEvent *event, int* data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
on_user_input (GIOChannel *channel, GIOCondition cond, LfbEvent *event)
|
on_user_input (GIOChannel *channel, GIOCondition cond, LfbEvent *event)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) err = NULL;
|
g_autoptr (GError) err = NULL;
|
||||||
|
|
||||||
if (cond == G_IO_IN) {
|
if (cond == G_IO_IN) {
|
||||||
g_print ("Ending feedback\n");
|
g_print ("Ending feedback\n");
|
||||||
@@ -62,9 +62,9 @@ on_user_input (GIOChannel *channel, GIOCondition cond, LfbEvent *event)
|
|||||||
static gboolean
|
static gboolean
|
||||||
trigger_event (const char *name, const gchar *profile, gboolean important, gint timeout)
|
trigger_event (const char *name, const gchar *profile, gboolean important, gint timeout)
|
||||||
{
|
{
|
||||||
g_autoptr(GError) err = NULL;
|
g_autoptr (GError) err = NULL;
|
||||||
g_autoptr(LfbEvent) event = NULL;
|
g_autoptr (LfbEvent) event = NULL;
|
||||||
g_autoptr(GIOChannel) input = NULL;
|
g_autoptr (GIOChannel) input = NULL;
|
||||||
int success = FALSE;
|
int success = FALSE;
|
||||||
|
|
||||||
g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL);
|
g_unix_signal_add (SIGTERM, on_shutdown_signal, NULL);
|
||||||
@@ -93,6 +93,9 @@ trigger_event (const char *name, const gchar *profile, gboolean important, gint
|
|||||||
g_main_loop_run (loop);
|
g_main_loop_run (loop);
|
||||||
g_main_loop_unref (loop);
|
g_main_loop_unref (loop);
|
||||||
|
|
||||||
|
if (lfb_event_get_end_reason (event) == LFB_EVENT_END_REASON_NOT_FOUND)
|
||||||
|
g_print ("No feedback found for '%s' at level '%s'\n", name, lfb_get_feedback_profile ());
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,8 +136,8 @@ set_profile (const gchar *profile)
|
|||||||
int
|
int
|
||||||
main (int argc, char *argv[0])
|
main (int argc, char *argv[0])
|
||||||
{
|
{
|
||||||
g_autoptr(GOptionContext) opt_context = NULL;
|
g_autoptr (GOptionContext) opt_context = NULL;
|
||||||
g_autoptr(GError) err = NULL;
|
g_autoptr (GError) err = NULL;
|
||||||
g_autofree char *profile = NULL;
|
g_autofree char *profile = NULL;
|
||||||
g_autofree char *app_id = NULL;
|
g_autofree char *app_id = NULL;
|
||||||
const char *name = NULL;
|
const char *name = NULL;
|
||||||
@@ -173,9 +176,9 @@ main (int argc, char *argv[0])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (profile && !name)
|
if (profile && !name) {
|
||||||
success = set_profile (profile);
|
success = set_profile (profile);
|
||||||
else {
|
} else {
|
||||||
if (!name)
|
if (!name)
|
||||||
name = g_strdup (DEFAULT_EVENT);
|
name = g_strdup (DEFAULT_EVENT);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user