[gnome-software/wip/hughsie/subpaths] flatpak: Support per-user Locale installation
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/subpaths] flatpak: Support per-user Locale installation
- Date: Mon, 10 Jul 2017 14:55:15 +0000 (UTC)
commit 0d334488948b2e035759b8661076546b2ab94364
Author: Richard Hughes <richard hughsie com>
Date: Mon Jul 10 11:07:42 2017 +0100
flatpak: Support per-user Locale installation
Based on a patch by Matthias Clasen <mclasen redhat com>, many thanks.
plugins/flatpak/gs-flatpak.c | 30 ++++++++++++++++++++++--------
plugins/flatpak/gs-flatpak.h | 2 ++
2 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index 5cf137b..6a5960e 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -142,6 +142,12 @@ gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
gs_app_set_flatpak_branch (app, flatpak_ref_get_branch (xref));
gs_app_set_flatpak_commit (app, flatpak_ref_get_commit (xref));
gs_app_set_flatpak_object_id (app, gs_flatpak_get_id (self));
+ if (FLATPAK_IS_RELATED_REF (xref)) {
+ g_autofree gchar *subpaths_str = NULL;
+ const char * const *subpaths = flatpak_related_ref_get_subpaths (FLATPAK_RELATED_REF (xref));
+ subpaths_str = g_strjoinv (":", (gchar **) subpaths);
+ gs_app_set_flatpak_subpaths (app, subpaths_str);
+ }
/* map the flatpak kind to the gnome-software kind */
if (flatpak_ref_get_kind (xref) == FLATPAK_REF_KIND_APP) {
@@ -2449,20 +2455,28 @@ install_runtime_for_app (GsFlatpak *self,
if (gs_app_get_state (runtime) == AS_APP_STATE_AVAILABLE) {
g_autoptr(FlatpakInstalledRef) xref = NULL;
g_autoptr(GsFlatpakProgressHelper) phelper = NULL;
+ const gchar *subpaths_str;
+ g_auto(GStrv) subpaths = NULL;
+
+ subpaths_str = gs_app_get_flatpak_subpaths (runtime);
+ if (subpaths != NULL)
+ subpaths = g_strsplit (subpaths_str, ":", -1);
g_debug ("%s/%s is not already installed, so installing",
gs_app_get_id (runtime),
gs_app_get_flatpak_branch (runtime));
gs_app_set_state (runtime, AS_APP_STATE_INSTALLING);
phelper = gs_flatpak_progress_helper_new (self->plugin, app);
- xref = flatpak_installation_install (self->installation,
- gs_app_get_origin (runtime),
- gs_app_get_flatpak_kind (runtime),
- gs_app_get_flatpak_name (runtime),
- gs_app_get_flatpak_arch (runtime),
- gs_app_get_flatpak_branch (runtime),
- gs_flatpak_progress_cb, phelper,
- cancellable, error);
+ xref = flatpak_installation_install_full (self->installation,
+ FLATPAK_INSTALL_FLAGS_NONE,
+ gs_app_get_origin (runtime),
+ gs_app_get_flatpak_kind (runtime),
+ gs_app_get_flatpak_name (runtime),
+ gs_app_get_flatpak_arch (runtime),
+ gs_app_get_flatpak_branch (runtime),
+ (const char * const *) subpaths,
+ gs_flatpak_progress_cb, phelper,
+ cancellable, error);
if (xref == NULL) {
gs_plugin_flatpak_error_convert (error);
gs_app_set_state_recover (runtime);
diff --git a/plugins/flatpak/gs-flatpak.h b/plugins/flatpak/gs-flatpak.h
index 5773eee..bf01f27 100644
--- a/plugins/flatpak/gs-flatpak.h
+++ b/plugins/flatpak/gs-flatpak.h
@@ -39,12 +39,14 @@ G_DECLARE_FINAL_TYPE (GsFlatpak, gs_flatpak, GS, FLATPAK, GObject)
#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_subpaths(app) gs_app_get_metadata_item(app,"flatpak::subpaths")
#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_subpaths(app,val) gs_app_set_metadata(app,"flatpak::subpaths",val)
typedef enum {
GS_FLATPAK_FLAG_NONE = 0,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]