diff --git a/xdg-app-builtins-add-remote.c b/xdg-app-builtins-add-remote.c index 624a9a4de..697df6c32 100644 --- a/xdg-app-builtins-add-remote.c +++ b/xdg-app-builtins-add-remote.c @@ -7,6 +7,7 @@ #include "libgsystem.h" #include "xdg-app-builtins.h" +#include "xdg-app-utils.h" static gboolean opt_no_gpg_verify; static gboolean opt_if_not_exists; @@ -26,6 +27,8 @@ xdg_app_builtin_add_remote (int argc, char **argv, GCancellable *cancellable, GE gboolean ret = FALSE; gs_unref_object XdgAppDir *dir = NULL; gs_unref_variant_builder GVariantBuilder *optbuilder = NULL; + gs_unref_hashtable GHashTable *refs = NULL; + gs_free char *title = NULL; const char *remote_name; const char *remote_url; @@ -45,14 +48,24 @@ xdg_app_builtin_add_remote (int argc, char **argv, GCancellable *cancellable, GE optbuilder = g_variant_builder_new (G_VARIANT_TYPE ("a{sv}")); + if (!ostree_repo_load_summary (remote_url, &refs, &title, cancellable, error)) + goto out; + if (opt_no_gpg_verify) g_variant_builder_add (optbuilder, "{s@v}", "gpg-verify", g_variant_new_variant (g_variant_new_boolean (FALSE))); + if (opt_title) + { + g_free (title); + title = g_strdup (opt_title); + } + + if (title) g_variant_builder_add (optbuilder, "{s@v}", "xa.title", - g_variant_new_variant (g_variant_new_string (opt_title))); + g_variant_new_variant (g_variant_new_string (title))); if (!ostree_repo_remote_change (xdg_app_dir_get_repo (dir), NULL, opt_if_not_exists ? OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS :