[gnome-software/wip/hughsie/sandbox-ui: 2/7] Set the origin-hostname from the flatpak plugins
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/sandbox-ui: 2/7] Set the origin-hostname from the flatpak plugins
- Date: Thu, 7 Jul 2016 19:43:00 +0000 (UTC)
commit accac9d44aeec9d8f9e1a7c574a83f221ccc420f
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 7 09:11:22 2016 +0100
Set the origin-hostname from the flatpak plugins
src/gs-self-test.c | 2 ++
src/plugins/gs-flatpak.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index 5d72aa6..ccdd89f 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -733,6 +733,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
/* find available application */
list = gs_plugin_loader_search (plugin_loader,
"Bingo",
+ GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS |
GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON,
NULL,
@@ -749,6 +750,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
g_assert_cmpint (gs_app_get_kudos (app), ==, GS_APP_KUDO_HAS_KEYWORDS |
GS_APP_KUDO_SANDBOXED_SECURE |
GS_APP_KUDO_SANDBOXED);
+ g_assert_cmpstr (gs_app_get_origin_hostname (app), ==, "");
/* install, also installing runtime */
ret = gs_plugin_loader_app_action (plugin_loader, app,
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index ff002a5..fedbaae 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -700,6 +700,28 @@ gs_plugin_refine_item_origin_ui (GsFlatpak *self, GsApp *app,
}
static gboolean
+gs_plugin_refine_item_origin_hostname (GsFlatpak *self, GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
+{
+ g_autoptr(FlatpakRemote) xremote = NULL;
+
+ /* already set */
+ if (gs_app_get_origin_hostname (app) != NULL)
+ return TRUE;
+
+ /* get the remote */
+ xremote = flatpak_installation_get_remote_by_name (self->installation,
+ gs_app_get_origin (app),
+ cancellable,
+ error);
+ if (xremote == NULL)
+ return FALSE;
+ gs_app_set_origin_hostname (app, flatpak_remote_get_url (xremote));
+ return TRUE;
+}
+
+static gboolean
gs_refine_item_metadata (GsFlatpak *self, GsApp *app,
GCancellable *cancellable,
GError **error)
@@ -1175,6 +1197,14 @@ gs_flatpak_refine_app (GsFlatpak *self,
return FALSE;
}
+ /* origin-hostname */
+ if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME) {
+ if (!gs_plugin_refine_item_origin_hostname (self, app,
+ cancellable,
+ error))
+ return FALSE;
+ }
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]