[gnome-software] lib: Add PARENTAL_NOT_LAUNCHABLE quirk to prevent launching apps



commit f700323ba587b1931f5191c1c003aca2648ead02
Author: Philip Withnall <withnall endlessm com>
Date:   Mon Nov 26 14:52:03 2018 +0000

    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 <withnall endlessm com>

 lib/gs-app.h          | 2 ++
 src/gs-details-page.c | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/lib/gs-app.h b/lib/gs-app.h
index a66c595b..42c91071 100644
--- a/lib/gs-app.h
+++ b/lib/gs-app.h
@@ -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;
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 73dba606..6af9af7d 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]