libostree: Get and set OstreeAsyncProgress:status atomically

Use the new well-known `status` key for OstreeAsyncProgress to get and
set the status atomically with other keys in an OstreeAsyncProgress
instance.

Signed-off-by: Philip Withnall <withnall@endlessm.com>

Closes: #819
Approved by: cgwalters
This commit is contained in:
Philip Withnall 2017-04-28 19:32:17 +01:00 committed by Atomic Bot
parent ce83abb868
commit cbe3989b2b
2 changed files with 4 additions and 5 deletions

View File

@ -240,10 +240,10 @@ update_progress (gpointer user_data)
/* We fetch metadata before content. These allow us to report metadata fetch progress specifically. */
"outstanding-metadata-fetches", "u", pull_data->n_outstanding_metadata_fetches,
"metadata-fetched", "u", pull_data->n_fetched_metadata,
/* Overall status. */
"status", "s", "",
NULL);
ostree_async_progress_set_status (pull_data->progress, NULL);
if (pull_data->dry_run)
pull_data->dry_run_emitted_progress = TRUE;

View File

@ -3748,8 +3748,6 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
buf = g_string_new ("");
status = ostree_async_progress_get_status (progress);
ostree_async_progress_get (progress,
"outstanding-fetches", "u", &outstanding_fetches,
"outstanding-metadata-fetches", "u", &outstanding_metadata_fetches,
@ -3760,9 +3758,10 @@ ostree_repo_pull_default_console_progress_changed (OstreeAsyncProgress *progress
"total-delta-parts", "u", &total_delta_parts,
"fetched-delta-fallbacks", "u", &fetched_delta_part_fallbacks,
"total-delta-fallbacks", "u", &total_delta_part_fallbacks,
"status", "s", &status,
NULL);
if (status)
if (*status != '\0')
{
g_string_append (buf, status);
}