[gnome-games] desktop-tracker-query: Check game displayability



commit 53d476225334d7bdc4810ffeefd170756235e765
Author: theawless <theawless gmail com>
Date:   Fri Mar 24 16:03:13 2017 +0530

    desktop-tracker-query: Check game displayability
    
    Prevent display of desktop games which specify NoDisplay or Hidden key
    as true.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=780295

 plugins/desktop/src/desktop-tracker-query.vala |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/plugins/desktop/src/desktop-tracker-query.vala b/plugins/desktop/src/desktop-tracker-query.vala
index bd311d0..caf0afb 100644
--- a/plugins/desktop/src/desktop-tracker-query.vala
+++ b/plugins/desktop/src/desktop-tracker-query.vala
@@ -89,11 +89,20 @@ private class Games.DesktopTrackerQuery : Object, TrackerQuery {
                if (app_info == null)
                        throw new DesktopError.INVALID_APPINFO (_("Couldn’t parse desktop entry “%s”."), 
path);
 
+               check_displayability (app_info);
                check_categories (app_info);
                check_executable (app_info);
                check_base_name (file);
        }
 
+       private void check_displayability (DesktopAppInfo app_info) throws Error {
+               if (app_info.get_nodisplay ())
+                       throw new DesktopError.BLACKLISTED_GAME (_("“%s” shouldn’t be displayed."), 
app_info.filename);
+
+               if (app_info.get_is_hidden ())
+                       throw new DesktopError.BLACKLISTED_GAME (_("“%s” is hidden."), app_info.filename);
+       }
+
        private void check_categories (DesktopAppInfo app_info) throws Error {
                var categories_string = app_info.get_categories ();
                var categories = categories_string.split (";");


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