diff options
author | Alexander Larsson <alexl@redhat.com> | 2019-04-10 14:28:25 +0200 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2019-04-10 14:34:32 +0000 |
commit | 889e3b862a51bb6265deb976f699646427fdd195 (patch) | |
tree | 4cbd33ff24fefd0b36b510542ae53b7fce581f70 /common | |
parent | 69e869c9d22c643044119a917e23a1e8536a7a2a (diff) | |
download | flatpak-889e3b862a51bb6265deb976f699646427fdd195.tar.gz |
build-update-repo: Support setting comment/description/homepage/icon
This just sets the option in the "flatpak" group, similar to how
the title works. Nothing uses this yet.
Closes: #2814
Approved by: alexlarsson
Diffstat (limited to 'common')
-rw-r--r-- | common/flatpak-utils-private.h | 12 | ||||
-rw-r--r-- | common/flatpak-utils.c | 81 |
2 files changed, 93 insertions, 0 deletions
diff --git a/common/flatpak-utils-private.h b/common/flatpak-utils-private.h index 37f5c75c..5960aed8 100644 --- a/common/flatpak-utils-private.h +++ b/common/flatpak-utils-private.h @@ -379,6 +379,18 @@ gboolean flatpak_switch_symlink_and_remove (const char *symlink_path, gboolean flatpak_repo_set_title (OstreeRepo *repo, const char *title, GError **error); +gboolean flatpak_repo_set_comment (OstreeRepo *repo, + const char *comment, + GError **error); +gboolean flatpak_repo_set_description (OstreeRepo *repo, + const char *description, + GError **error); +gboolean flatpak_repo_set_icon (OstreeRepo *repo, + const char *icon, + GError **error); +gboolean flatpak_repo_set_homepage (OstreeRepo *repo, + const char *homepage, + GError **error); gboolean flatpak_repo_set_redirect_url (OstreeRepo *repo, const char *redirect_url, GError **error); diff --git a/common/flatpak-utils.c b/common/flatpak-utils.c index 71442ac7..79eb6f73 100644 --- a/common/flatpak-utils.c +++ b/common/flatpak-utils.c @@ -2601,6 +2601,87 @@ flatpak_repo_set_title (OstreeRepo *repo, } gboolean +flatpak_repo_set_comment (OstreeRepo *repo, + const char *comment, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (comment) + g_key_file_set_string (config, "flatpak", "comment", comment); + else + g_key_file_remove_key (config, "flatpak", "comment", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + +gboolean +flatpak_repo_set_description (OstreeRepo *repo, + const char *description, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (description) + g_key_file_set_string (config, "flatpak", "description", description); + else + g_key_file_remove_key (config, "flatpak", "description", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + + +gboolean +flatpak_repo_set_icon (OstreeRepo *repo, + const char *icon, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (icon) + g_key_file_set_string (config, "flatpak", "icon", icon); + else + g_key_file_remove_key (config, "flatpak", "icon", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + +gboolean +flatpak_repo_set_homepage (OstreeRepo *repo, + const char *homepage, + GError **error) +{ + g_autoptr(GKeyFile) config = NULL; + + config = ostree_repo_copy_config (repo); + + if (homepage) + g_key_file_set_string (config, "flatpak", "homepage", homepage); + else + g_key_file_remove_key (config, "flatpak", "homepage", NULL); + + if (!ostree_repo_write_config (repo, config, error)) + return FALSE; + + return TRUE; +} + +gboolean flatpak_repo_set_redirect_url (OstreeRepo *repo, const char *redirect_url, GError **error) |