Commit 41304c36 authored by Guido Gunther's avatar Guido Gunther Committed by Guido Gunther
Browse files

cli: Allow to set profile per event

We allowed set the global profile via `-P` use it as per event
profile when used with `-E`.

Ironically the manpage always said it'd be that way.
parent dfafe8d7
...@@ -71,6 +71,8 @@ trigger_event (const char *name, const gchar *profile, gint timeout) ...@@ -71,6 +71,8 @@ trigger_event (const char *name, const gchar *profile, gint timeout)
g_print ("Triggering feedback for event '%s'\n", name); g_print ("Triggering feedback for event '%s'\n", name);
event = lfb_event_new (name); event = lfb_event_new (name);
lfb_event_set_timeout (event, timeout); lfb_event_set_timeout (event, timeout);
if (profile)
lfb_event_set_feedback_profile (event, profile);
g_signal_connect (event, "feedback-ended", (GCallback)on_feedback_ended, &success); g_signal_connect (event, "feedback-ended", (GCallback)on_feedback_ended, &success);
if (!lfb_event_trigger_feedback (event, &err)) { if (!lfb_event_trigger_feedback (event, &err)) {
...@@ -162,10 +164,10 @@ main (int argc, char *argv[0]) ...@@ -162,10 +164,10 @@ main (int argc, char *argv[0])
name = g_strdup (DEFAULT_EVENT); name = g_strdup (DEFAULT_EVENT);
g_timeout_add_seconds (watch, (GSourceFunc)on_watch_expired, NULL); g_timeout_add_seconds (watch, (GSourceFunc)on_watch_expired, NULL);
if (profile) if (profile && !name)
success = set_profile (profile); success = set_profile (profile);
else else
success = trigger_event (name, timeout); success = trigger_event (name, profile, timeout);
lfb_uninit (); lfb_uninit ();
return !success; return !success;
......
...@@ -70,7 +70,8 @@ print help and exit ...@@ -70,7 +70,8 @@ print help and exit
<term><option>--profile=<replaceable>PROFILE</replaceable></option></term> <term><option>--profile=<replaceable>PROFILE</replaceable></option></term>
<para> <para>
The feedback profile (<literal>full</literal>, <literal>quiet</literal>, <literal>silent</literal>) The feedback profile (<literal>full</literal>, <literal>quiet</literal>, <literal>silent</literal>)
to use for the given event. to use for the given event. If no event is specified then the global
feedback profile is changed.
</para> </para>
</varlistentry> </varlistentry>
......
Supports Markdown
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