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
on_hifstate_percentage_changed (DnfState   *hifstate,
                                guint       percentage,
                                gpointer    user_data)
{
  const char *text = user_data;
  glnx_console_progress_text_percent (text, percentage);
}
static void
add_status_line (TransactionProgress *self,
                 const char *line,
                 int percentage)
{
  self->in_status_line = TRUE;
  if (!self->console.locked)
    glnx_console_lock (&self->console);
  if (percentage < 0)
    glnx_console_text (line);
  else
    glnx_console_progress_text_percent (line, percentage);
}
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;
  }
}