[gnome-games/wip/exalm/uid: 4/18] desktop: Remove DesktopUid



commit 544b1342f1a76761590f91f9fdf64a882d7128ac
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Feb 21 16:10:48 2020 +0500

    desktop: Remove DesktopUid
    
    Replace it with GenericUid and a simple function.

 plugins/desktop/src/desktop-plugin.vala |  9 ++++++++-
 plugins/desktop/src/desktop-uid.vala    | 22 ----------------------
 plugins/desktop/src/meson.build         |  1 -
 3 files changed, 8 insertions(+), 24 deletions(-)
---
diff --git a/plugins/desktop/src/desktop-plugin.vala b/plugins/desktop/src/desktop-plugin.vala
index 8d4759f2..2f89356b 100644
--- a/plugins/desktop/src/desktop-plugin.vala
+++ b/plugins/desktop/src/desktop-plugin.vala
@@ -47,6 +47,13 @@ private class Games.DesktopPlugin : Object, Plugin {
                return { factory };
        }
 
+       private static string get_uid (DesktopAppInfo app_info) {
+               var appid = app_info.get_id ();
+               var hash = Checksum.compute_for_string (ChecksumType.SHA256, appid);
+
+               return @"$PLATFORM_UID_PREFIX-$hash";
+       }
+
        private static Game game_for_uri (Uri uri) throws Error {
                check_uri (uri);
 
@@ -54,7 +61,7 @@ private class Games.DesktopPlugin : Object, Plugin {
                var path = file.get_path ();
 
                var app_info = new DesktopAppInfo.from_filename (path);
-               var uid = new DesktopUid (app_info);
+               var uid = new GenericUid (get_uid (app_info));
                var title = new DesktopTitle (app_info);
                var icon = new DesktopIcon (app_info);
 
diff --git a/plugins/desktop/src/meson.build b/plugins/desktop/src/meson.build
index e139521e..be7eb4ce 100644
--- a/plugins/desktop/src/meson.build
+++ b/plugins/desktop/src/meson.build
@@ -4,7 +4,6 @@ vala_sources = [
   'desktop-plugin.vala',
   'desktop-title.vala',
   'desktop-tracker-uri-query.vala',
-  'desktop-uid.vala',
 ]
 
 c_args = [


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