From ec9e55f140fff871f79e20264b147d367a7db763 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 9 Apr 2019 18:58:26 -0400 Subject: [PATCH] remote-add: Store all .flatpakrepo keys Application installers want to have access to these fields to present repositories to the user, so store them in our repo config, using xa. prefixed keys. Closes: #2812 Approved by: alexlarsson --- app/flatpak-builtins-remote-add.c | 41 +++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/app/flatpak-builtins-remote-add.c b/app/flatpak-builtins-remote-add.c index c69c19a1..494e7a1a 100644 --- a/app/flatpak-builtins-remote-add.c +++ b/app/flatpak-builtins-remote-add.c @@ -49,6 +49,11 @@ static char *opt_collection_id = NULL; static gboolean opt_from; static char **opt_gpg_import; +static char *comment = NULL; +static char *description = NULL; +static char *icon = NULL; +static char *homepage = NULL; + static GOptionEntry add_options[] = { { "if-not-exists", 0, 0, G_OPTION_ARG_NONE, &opt_if_not_exists, N_("Do nothing if the provided remote exists"), NULL }, @@ -164,6 +169,30 @@ get_config_from_opts (FlatpakDir *dir, const char *remote_name, gboolean *change *changed = TRUE; } + if (comment) + { + g_key_file_set_string (config, group, "xa.comment", comment); + *changed = TRUE; + } + + if (description) + { + g_key_file_set_string (config, group, "xa.description", description); + *changed = TRUE; + } + + if (icon) + { + g_key_file_set_string (config, group, "xa.icon", icon); + *changed = TRUE; + } + + if (homepage) + { + g_key_file_set_string (config, group, "xa.homepage", homepage); + *changed = TRUE; + } + return config; } @@ -277,6 +306,18 @@ load_options (const char *filename, if (!opt_no_gpg_verify) opt_do_gpg_verify = TRUE; } + + comment = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, + FLATPAK_REPO_COMMENT_KEY, NULL); + + description = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, + FLATPAK_REPO_DESCRIPTION_KEY, NULL); + + icon = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, + FLATPAK_REPO_ICON_KEY, NULL); + + homepage = g_key_file_get_string (keyfile, FLATPAK_REPO_GROUP, + FLATPAK_REPO_HOMEPAGE_KEY, NULL); } gboolean