Merge branch 'important-vs-app-level' into 'main'
feedback-manager: Let app level cap important level Closes #93 See merge request agx/feedbackd!188
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
'sm.puri.OSK0']</default>
|
||||
<summary>List of apps that can override the feedback level</summary>
|
||||
<description>
|
||||
Apps listed here can override the configured feedack level by
|
||||
Apps listed here can override the configured global feedback level by
|
||||
setting the 'important' hint on the submitted event.
|
||||
</description>
|
||||
</key>
|
||||
|
||||
+2
-2
@@ -51,8 +51,8 @@ These gsettings are used by ``feedbackd``:
|
||||
|
||||
- `profile`: The current overall feedback profile. Valid values are
|
||||
`full`, `quiet` and `silent`.
|
||||
- `allow-important`: List of apps that can override the feedback level
|
||||
(useful for e.g. allowing the alarm clock to also emit sound when
|
||||
- `allow-important`: List of apps that can override the global feedback
|
||||
level (useful for e.g. allowing the alarm clock to also emit sound when
|
||||
device is in silent mode).
|
||||
- `prefer-flash`: Prefer camera flash over status LED
|
||||
- `theme`: The feedback theme to use. This can be used to override
|
||||
|
||||
@@ -687,7 +687,7 @@ lfb_event_end_feedback_async (LfbEvent *self,
|
||||
* @self: The event
|
||||
* @timeout: The timeout
|
||||
*
|
||||
* Tells the feedback server to end feedack after #timeout seconds.
|
||||
* Tells the feedback server to end feedback after #timeout seconds.
|
||||
* The value -1 indicates to not set a timeout and let feedbacks stop
|
||||
* on their own while 0 indicates to loop all feedbacks endlessly.
|
||||
* They must be stopped via [method@LfbEvent.end_feedback] in this case.
|
||||
@@ -817,7 +817,7 @@ lfb_event_get_feedback_profile (LfbEvent *self)
|
||||
*
|
||||
* Tells the feedback server that the sender deems this to be an
|
||||
* important event. A feedback server might allow the sender to
|
||||
* override the current feedback level when this is set.
|
||||
* override the current global feedback level when this is set.
|
||||
*/
|
||||
void
|
||||
lfb_event_set_important (LfbEvent *self, gboolean important)
|
||||
|
||||
@@ -371,7 +371,7 @@ parse_hints (GVariant *hints,
|
||||
/**
|
||||
* add_event_feedbacks:
|
||||
*
|
||||
* Add the suitable feedacks to the event.
|
||||
* Add the suitable feedbacks to the event.
|
||||
*
|
||||
* Returns: `TRUE` if at least on feedback was added.
|
||||
*/
|
||||
@@ -758,10 +758,11 @@ fbd_feedback_manager_get_effective_level (FbdFeedbackManager *self,
|
||||
app_level = app_get_feedback_level (app_id);
|
||||
can_important = app_is_important (self, app_id);
|
||||
|
||||
if (important && can_important)
|
||||
level = want_level;
|
||||
else
|
||||
if (important && can_important) {
|
||||
level = MIN (want_level, app_level);
|
||||
} else {
|
||||
level = get_max_level (self->level, app_level, want_level);
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user