void rpmostree_output_default_handler (RpmOstreeOutputType type, void *data, void *opaque) { switch (type) { case RPMOSTREE_OUTPUT_TASK_BEGIN: /* XXX: move to libglnx spinner once it's implemented */ g_print ("%s... ", ((RpmOstreeOutputTaskBegin*)data)->text); break; case RPMOSTREE_OUTPUT_TASK_END: g_print ("%s\n", ((RpmOstreeOutputTaskEnd*)data)->text); break; case RPMOSTREE_OUTPUT_PERCENT_PROGRESS: if (!console.locked) glnx_console_lock (&console); glnx_console_progress_text_percent ( ((RpmOstreeOutputPercentProgress*)data)->text, ((RpmOstreeOutputPercentProgress*)data)->percentage); break; case RPMOSTREE_OUTPUT_PERCENT_PROGRESS_END: if (console.locked) glnx_console_unlock (&console); break; } }
static void end_status_line (TransactionProgress *self) { if (self->in_status_line) { glnx_console_unlock (&self->console); self->in_status_line = FALSE; } }
void rpmostree_output_default_handler (RpmOstreeOutputType type, void *data, void *opaque) { switch (type) { case RPMOSTREE_OUTPUT_MESSAGE: g_print ("%s\n", ((RpmOstreeOutputMessage*)data)->text); break; case RPMOSTREE_OUTPUT_TASK_BEGIN: /* XXX: move to libglnx spinner once it's implemented */ g_print ("%s... ", ((RpmOstreeOutputTaskBegin*)data)->text); break; case RPMOSTREE_OUTPUT_TASK_END: g_print ("%s\n", ((RpmOstreeOutputTaskEnd*)data)->text); break; case RPMOSTREE_OUTPUT_PROGRESS_PERCENT: if (!console.locked) glnx_console_lock (&console); RpmOstreeOutputProgressPercent *prog = data; /* let's not spam stdout if it's not a tty; see dbus-helpers.c */ if (prog->percentage == 100 || console.is_tty) glnx_console_progress_text_percent (prog->text, prog->percentage); break; case RPMOSTREE_OUTPUT_PROGRESS_N_ITEMS: { RpmOstreeOutputProgressNItems *nitems = data; if (!console.locked) glnx_console_lock (&console); glnx_console_progress_n_items (nitems->text, nitems->current, nitems->total); } break; case RPMOSTREE_OUTPUT_PROGRESS_END: if (console.locked) glnx_console_unlock (&console); break; } }