feedback-manager: Parse important hint

This commit is contained in:
Guido Günther
2024-04-20 13:21:56 +00:00
committed by Guido Günther
parent 14ffd9722d
commit 716f296ab8
+10 -4
View File
@@ -307,17 +307,22 @@ get_max_level (FbdFeedbackProfileLevel global_level,
}
static gboolean
parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level)
parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level, gboolean *hint_important)
{
const gchar *profile;
gboolean found;
gboolean found, important;
g_auto (GVariantDict) dict = G_VARIANT_DICT_INIT (NULL);
g_variant_dict_init (&dict, hints);
found = g_variant_dict_lookup (&dict, "profile", "&s", &profile);
found = g_variant_dict_lookup (&dict, "profile", "&s", &profile);
if (level && found)
*level = fbd_feedback_profile_level (profile);
found = g_variant_dict_lookup (&dict, "important", "b", &important);
if (hint_important && found)
*hint_important = important;
return TRUE;
}
@@ -336,6 +341,7 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
const gchar *sender;
FbdFeedbackProfileLevel app_level, level, hint_level = FBD_FEEDBACK_PROFILE_LEVEL_FULL;
gboolean found_fb = FALSE;
gboolean hint_important = FALSE;
sender = g_dbus_method_invocation_get_sender (invocation);
g_debug ("Event '%s' for '%s' from %s", arg_event, arg_app_id, sender);
@@ -359,7 +365,7 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
return TRUE;
}
if (!parse_hints (arg_hints, &hint_level)) {
if (!parse_hints (arg_hints, &hint_level, &hint_important)) {
g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR,
G_DBUS_ERROR_INVALID_ARGS,
"Invalid hints");