From 716f296ab88b0e00da3cda0b82ae701dc5bd5fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Tue, 9 Apr 2024 13:22:11 +0200 Subject: [PATCH] feedback-manager: Parse important hint --- src/fbd-feedback-manager.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/fbd-feedback-manager.c b/src/fbd-feedback-manager.c index 0866751..c484312 100644 --- a/src/fbd-feedback-manager.c +++ b/src/fbd-feedback-manager.c @@ -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");