feedback-manager: Parse important hint
This commit is contained in:
committed by
Guido Günther
parent
14ffd9722d
commit
716f296ab8
@@ -307,17 +307,22 @@ get_max_level (FbdFeedbackProfileLevel global_level,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level)
|
parse_hints (GVariant *hints, FbdFeedbackProfileLevel *level, gboolean *hint_important)
|
||||||
{
|
{
|
||||||
const gchar *profile;
|
const gchar *profile;
|
||||||
gboolean found;
|
gboolean found, important;
|
||||||
g_auto (GVariantDict) dict = G_VARIANT_DICT_INIT (NULL);
|
g_auto (GVariantDict) dict = G_VARIANT_DICT_INIT (NULL);
|
||||||
|
|
||||||
g_variant_dict_init (&dict, hints);
|
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)
|
if (level && found)
|
||||||
*level = fbd_feedback_profile_level (profile);
|
*level = fbd_feedback_profile_level (profile);
|
||||||
|
|
||||||
|
found = g_variant_dict_lookup (&dict, "important", "b", &important);
|
||||||
|
if (hint_important && found)
|
||||||
|
*hint_important = important;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,6 +341,7 @@ fbd_feedback_manager_handle_trigger_feedback (LfbGdbusFeedback *object,
|
|||||||
const gchar *sender;
|
const gchar *sender;
|
||||||
FbdFeedbackProfileLevel app_level, level, hint_level = FBD_FEEDBACK_PROFILE_LEVEL_FULL;
|
FbdFeedbackProfileLevel app_level, level, hint_level = FBD_FEEDBACK_PROFILE_LEVEL_FULL;
|
||||||
gboolean found_fb = FALSE;
|
gboolean found_fb = FALSE;
|
||||||
|
gboolean hint_important = FALSE;
|
||||||
|
|
||||||
sender = g_dbus_method_invocation_get_sender (invocation);
|
sender = g_dbus_method_invocation_get_sender (invocation);
|
||||||
g_debug ("Event '%s' for '%s' from %s", arg_event, arg_app_id, sender);
|
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;
|
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_method_invocation_return_error (invocation, G_DBUS_ERROR,
|
||||||
G_DBUS_ERROR_INVALID_ARGS,
|
G_DBUS_ERROR_INVALID_ARGS,
|
||||||
"Invalid hints");
|
"Invalid hints");
|
||||||
|
|||||||
Reference in New Issue
Block a user