Commit f700323b authored by Philip Withnall's avatar Philip Withnall Committed by Richard Hughes

lib: Add PARENTAL_NOT_LAUNCHABLE quirk to prevent launching apps

As well as filtering installation of applications, parental controls
need to prevent launching banned applications which are already
installed on the system (perhaps for other users). While installation is
controlled through OARS ratings, launching is controlled via a
blacklist.

Add a new quirk to GsApp for apps which should not be launchable due to
violating the blacklist, and check for it on the details page.

It is up to vendor plugins to implement the policy to set this quirk on
apps.
Signed-off-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
parent 07e9d679
......@@ -99,6 +99,7 @@ typedef enum {
* @GS_APP_QUIRK_DEVELOPER_VERIFIED: The app developer has been verified
* @GS_APP_QUIRK_PARENTAL_FILTER: The app has been filtered by parental controls, and should be hidden
* @GS_APP_QUIRK_NEW_PERMISSIONS: The update requires new permissions
* @GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE: The app cannot be run by the current user due to parental controls, and should not be launchable
*
* The application attributes.
**/
......@@ -118,6 +119,7 @@ typedef enum {
GS_APP_QUIRK_DEVELOPER_VERIFIED = 1 << 11, /* Since: 3.32 */
GS_APP_QUIRK_PARENTAL_FILTER = 1 << 12, /* Since: 3.32 */
GS_APP_QUIRK_NEW_PERMISSIONS = 1 << 13, /* Since: 3.32 */
GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE = 1 << 14, /* Since: 3.32 */
/*< private >*/
GS_APP_QUIRK_LAST
} GsAppQuirk;
......
......@@ -876,7 +876,8 @@ gs_details_page_refresh_buttons (GsDetailsPage *self)
case AS_APP_STATE_INSTALLED:
case AS_APP_STATE_UPDATABLE:
case AS_APP_STATE_UPDATABLE_LIVE:
if (!gs_app_has_quirk (self->app, GS_APP_QUIRK_NOT_LAUNCHABLE)) {
if (!gs_app_has_quirk (self->app, GS_APP_QUIRK_NOT_LAUNCHABLE) &&
!gs_app_has_quirk (self->app, GS_APP_QUIRK_PARENTAL_NOT_LAUNCHABLE)) {
gtk_widget_set_visible (self->button_details_launch, TRUE);
} else {
gtk_widget_set_visible (self->button_details_launch, FALSE);
......
Markdown is supported
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