forked from Mirrors/flatpak-builder
Better handling of the title in the summary
Now we store the title in the repo config and re-apply it every time we regenerate the summary.tingping/wmclass
parent
93e8d8bd78
commit
cb971722fe
|
@ -407,8 +407,7 @@ xdg_app_builtin_build_export (int argc, char **argv, GCancellable *cancellable,
|
|||
if (!ostree_repo_commit_transaction (repo, &stats, cancellable, error))
|
||||
goto out;
|
||||
|
||||
if (!ostree_repo_regenerate_summary (repo,
|
||||
NULL,
|
||||
if (!xdg_app_repo_update (repo,
|
||||
cancellable,
|
||||
error))
|
||||
goto out;
|
||||
|
|
|
@ -46,7 +46,6 @@ xdg_app_builtin_build_update_repo (int argc, char **argv, GCancellable *cancella
|
|||
g_autoptr(GFile) repofile = NULL;
|
||||
g_autoptr(OstreeRepo) repo = NULL;
|
||||
const char *location;
|
||||
GVariant *extra = NULL;
|
||||
|
||||
context = g_option_context_new ("LOCATION - Update repository metadata");
|
||||
|
||||
|
@ -64,19 +63,12 @@ xdg_app_builtin_build_update_repo (int argc, char **argv, GCancellable *cancella
|
|||
if (!ostree_repo_open (repo, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
if (opt_title)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
|
||||
g_variant_builder_add (&builder, "{sv}", "xa.title", g_variant_new_string (opt_title));
|
||||
extra = g_variant_builder_end (&builder);
|
||||
}
|
||||
|
||||
if (!ostree_repo_regenerate_summary (repo, extra, cancellable, error))
|
||||
if (opt_title &&
|
||||
!xdg_app_repo_set_title (repo, opt_title, error))
|
||||
return FALSE;
|
||||
|
||||
/* TODO: appstream data */
|
||||
if (!xdg_app_repo_update (repo, cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -1293,3 +1293,54 @@ xdg_app_variant_bsearch_str (GVariant *array,
|
|||
*out_pos = imid;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_repo_set_title (OstreeRepo *repo,
|
||||
const char *title,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GKeyFile) config = NULL;
|
||||
|
||||
config = ostree_repo_copy_config (repo);
|
||||
|
||||
if (title)
|
||||
g_key_file_set_string (config, "xdg-app", "title", title);
|
||||
else
|
||||
g_key_file_remove_key (config, "xdg-app", "title", NULL);
|
||||
|
||||
if (!ostree_repo_write_config (repo, config, error))
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
xdg_app_repo_update (OstreeRepo *repo,
|
||||
GCancellable *cancellable,
|
||||
GError **error)
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
GKeyFile *config;
|
||||
g_autofree char *title = NULL;
|
||||
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
|
||||
|
||||
config = ostree_repo_get_config (repo);
|
||||
|
||||
if (config)
|
||||
{
|
||||
title = g_key_file_get_string (config, "xdg-app", "title", NULL);
|
||||
}
|
||||
|
||||
if (title)
|
||||
g_variant_builder_add (&builder, "{sv}", "xa.title",
|
||||
g_variant_new_string (title));
|
||||
|
||||
if (!ostree_repo_regenerate_summary (repo, g_variant_builder_end (&builder),
|
||||
cancellable, error))
|
||||
return FALSE;
|
||||
|
||||
/* TODO: appstream data */
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -169,6 +169,13 @@ void xdg_app_table_printer_append_with_comma (XdgAppTablePrinter
|
|||
void xdg_app_table_printer_finish_row (XdgAppTablePrinter *printer);
|
||||
void xdg_app_table_printer_print (XdgAppTablePrinter *printer);
|
||||
|
||||
gboolean xdg_app_repo_set_title (OstreeRepo *repo,
|
||||
const char *title,
|
||||
GError **error);
|
||||
gboolean xdg_app_repo_update (OstreeRepo *repo,
|
||||
GCancellable *cancellable,
|
||||
GError **error);
|
||||
|
||||
gboolean xdg_app_spawn (GFile *dir,
|
||||
char **output,
|
||||
GError **error,
|
||||
|
|
Loading…
Reference in New Issue