[gnome-software/wip/hughsie/unique_id] f



commit 2f013bebb726b2da1c96fa95d84c2ccbb467d6d3
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 29 21:07:30 2016 +0100

    f

 src/gs-app.c                      |    5 -----
 src/plugins/gs-flatpak.c          |   15 ++++++++-------
 src/plugins/gs-plugin-appstream.c |   17 +++++++++--------
 3 files changed, 17 insertions(+), 20 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index ffda463..180f681 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -850,11 +850,6 @@ void
 gs_app_set_unique_id (GsApp *app, const gchar *unique_id)
 {
        g_return_if_fail (GS_IS_APP (app));
-
-       /* check for validity */
-       if (!as_utils_unique_id_valid (unique_id))
-               g_warning ("unique ID %s is not valid!", unique_id);
-
        g_free (app->unique_id);
        app->unique_id = g_strdup (unique_id);
 }
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index cc82a35..f155964 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -304,6 +304,7 @@ gs_flatpak_build_unique_id (FlatpakInstallation *installation, FlatpakRef *xref)
 {
        const gchar *scope = "system";
        g_autofree gchar *id = NULL;
+       g_autoptr(AsAppRef) app_ref = NULL;
 
        /* use a different prefix if we're somehow running this as per-user */
        if (flatpak_installation_get_is_user (installation))
@@ -311,13 +312,13 @@ gs_flatpak_build_unique_id (FlatpakInstallation *installation, FlatpakRef *xref)
 
        /* flatpak doesn't use a suffix; AppStream does */
        id = gs_flatpak_build_id (xref);
-       return as_utils_unique_id_build (scope,
-                                        "flatpak",
-                                        NULL, /* origin */
-                                        _flatpak_ref_kind_to_string (flatpak_ref_get_kind (xref)),
-                                        id,
-                                        flatpak_ref_get_arch (xref),
-                                        flatpak_ref_get_branch (xref));
+       app_ref = as_app_ref_new (id);
+       as_app_ref_set_scope (app_ref, scope);
+       as_app_ref_set_system (app_ref, "flatpak");
+       as_app_ref_set_kind (app_ref, _flatpak_ref_kind_to_string (flatpak_ref_get_kind (xref)));
+       as_app_ref_set_arch (app_ref, flatpak_ref_get_arch (xref));
+       as_app_ref_set_branch (app_ref, flatpak_ref_get_branch (xref));
+       return as_app_ref_to_string (app_ref);
 }
 
 static GsApp *
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 28708a6..db69f7e 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -276,18 +276,19 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
 
        /* add keyword for non-package sources */
        for (i = 0; i < items->len; i++) {
-               g_auto(GStrv) split = NULL;
+               const gchar *system;
+               g_autoptr(AsAppRef) app_ref = NULL;
                app = g_ptr_array_index (items, i);
-               split = as_utils_unique_id_split (as_app_get_unique_id (app));
-               if (split == NULL)
+               app_ref = as_app_ref_new_from_string (as_app_get_unique_id (app));
+               if (app_ref == NULL)
                        continue;
-               if (g_strcmp0 (split[1], "package") == 0)
+               system = as_app_ref_get_system (app_ref);
+               if (g_strcmp0 (system, "package") == 0)
                        continue;
-               if (g_strcmp0 (split[1], "*") == 0)
+               if (g_strcmp0 (system, "*") == 0)
                        continue;
-               g_debug ("Adding keyword '%s' to %s",
-                        split[1], as_app_get_id (app));
-               as_app_add_keyword (app, NULL, split[1]);
+               g_debug ("Adding keyword '%s' to %s", system, as_app_get_id (app));
+               as_app_add_keyword (app, NULL, system);
        }
 
        /* fix up these */


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