[gnome-software] trivial: Store the flatpak display ref on all apps
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] trivial: Store the flatpak display ref on all apps
- Date: Tue, 11 Jul 2017 16:11:44 +0000 (UTC)
commit b3e35ee88a9de35b59d542986dcf76b207e6a83a
Author: Richard Hughes <richard hughsie com>
Date: Tue Jul 11 13:50:44 2017 +0100
trivial: Store the flatpak display ref on all apps
plugins/flatpak/gs-flatpak-utils.h | 2 ++
plugins/flatpak/gs-flatpak.c | 14 ++++++++------
2 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak-utils.h b/plugins/flatpak/gs-flatpak-utils.h
index 3212cf1..653ccce 100644
--- a/plugins/flatpak/gs-flatpak-utils.h
+++ b/plugins/flatpak/gs-flatpak-utils.h
@@ -34,12 +34,14 @@ G_BEGIN_DECLS
#define gs_app_get_flatpak_commit(app) gs_app_get_metadata_item(app,"flatpak::commit")
#define gs_app_get_flatpak_file_type(app) gs_app_get_metadata_item(app,"flatpak::file-type")
#define gs_app_get_flatpak_object_id(app) gs_app_get_metadata_item(app,"flatpak::object-id")
+#define gs_app_get_flatpak_ref_display(app) gs_app_get_metadata_item(app,"flatpak::ref-display")
#define gs_app_set_flatpak_name(app,val) gs_app_set_metadata(app,"flatpak::name",val)
#define gs_app_set_flatpak_arch(app,val) gs_app_set_metadata(app,"flatpak::arch",val)
#define gs_app_set_flatpak_branch(app,val) gs_app_set_metadata(app,"flatpak::branch",val)
#define gs_app_set_flatpak_commit(app,val) gs_app_set_metadata(app,"flatpak::commit",val)
#define gs_app_set_flatpak_file_type(app,val) gs_app_set_metadata(app,"flatpak::file-type",val)
#define gs_app_set_flatpak_object_id(app,val) gs_app_set_metadata(app,"flatpak::object-id",val)
+#define gs_app_set_flatpak_ref_display(app,val) gs_app_set_metadata(app,"flatpak::ref-display",val)
void gs_flatpak_error_convert (GError **perror);
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index b498cca..4db884f 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -89,6 +89,8 @@ gs_plugin_refine_item_scope (GsFlatpak *self, GsApp *app)
static void
gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
{
+ g_autofree gchar *ref_display = NULL;
+
/* core */
gs_app_set_management_plugin (app, gs_plugin_get_name (self->plugin));
gs_app_set_bundle_kind (app, AS_BUNDLE_KIND_FLATPAK);
@@ -103,6 +105,10 @@ gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
gs_app_set_flatpak_commit (app, flatpak_ref_get_commit (xref));
gs_app_set_flatpak_object_id (app, gs_flatpak_get_id (self));
+ /* do this once for all objects */
+ ref_display = flatpak_ref_format_ref (xref);
+ gs_app_set_flatpak_ref_display (app, ref_display);
+
/* map the flatpak kind to the gnome-software kind */
if (flatpak_ref_get_kind (xref) == FLATPAK_REF_KIND_APP) {
gs_app_set_kind (app, AS_APP_KIND_DESKTOP);
@@ -2833,15 +2839,11 @@ gs_flatpak_update_app (GsFlatpak *self,
phelper->job_max = gs_app_list_length (list);
for (phelper->job_now = 0; phelper->job_now < phelper->job_max; phelper->job_now++) {
GsApp *app_tmp = gs_app_list_index (list, phelper->job_now);
- g_autofree gchar *xref_fake_str = NULL;
+ const gchar *xref_fake_str = NULL;
g_autoptr(FlatpakInstalledRef) xref = NULL;
- g_autoptr (FlatpakRef) xref_fake = NULL;
/* either install or update the ref */
- xref_fake = gs_flatpak_create_fake_ref (app_tmp, error);
- if (xref_fake == NULL)
- return FALSE;
- xref_fake_str = flatpak_ref_format_ref (xref_fake);
+ xref_fake_str = gs_app_get_flatpak_ref_display (app_tmp);
if (!g_hash_table_contains (hash_installed, xref_fake_str)) {
g_debug ("installing %s", xref_fake_str);
xref = flatpak_installation_install (self->installation,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]