[gnome-software: 2/2] Merge branch 'packagekit-installed-check' into 'main'




commit fb9f455b18135553125c18ff913e33db84b959ed
Merge: c6ff8d02f 3919d03d6
Author: Philip Withnall <philip tecnocode co uk>
Date:   Thu May 19 14:58:17 2022 +0000

    Merge branch 'packagekit-installed-check' into 'main'
    
    packagekit: Update package installed check to use new manual and auto statuses
    
    Closes #1720
    
    See merge request GNOME/gnome-software!1333

 plugins/packagekit/gs-plugin-packagekit.c | 28 ++++++++++++++++++++++++----
 1 file changed, 24 insertions(+), 4 deletions(-)
---
diff --cc plugins/packagekit/gs-plugin-packagekit.c
index f1af2650b,783dcfe8f..c5fc7ef58
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@@ -283,11 -283,30 +283,32 @@@ gs_plugin_packagekit_finalize (GObject 
  
  typedef gboolean (*GsAppFilterFunc) (GsApp *app);
  
+ static gboolean
+ package_is_installed (const gchar *package_id)
+ {
+       g_auto(GStrv) split = NULL;
+       const gchar *data;
+ 
+       split = pk_package_id_split (package_id);
+       if (split == NULL) {
+               return FALSE;
+       }
+ 
+       data = split[PK_PACKAGE_ID_DATA];
+       if (g_str_has_prefix (data, "installed") ||
+             g_str_has_prefix (data, "manual:") ||
+             g_str_has_prefix (data, "auto:")) {
+               return TRUE;
+       }
+ 
+       return FALSE;
+ }
+ 
  /* The elements in the returned #GPtrArray reference memory from within the
   * @apps list, so the array is only valid as long as @apps is not modified or
 - * freed. The array is not NULL-terminated. */
 + * freed. The array is not NULL-terminated.
 + *
 + * If @apps is %NULL, that’s considered equivalent to an empty list. */
  static GPtrArray *
  app_list_get_package_ids (GsAppList       *apps,
                            GsAppFilterFunc  app_filter,


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