Esempio n. 1
0
/* NB: "noalloc" function. */
value
guestfs_int_mllib_progress_bar_set (value barv,
                                    value positionv, value totalv)
{
  struct progress_bar *bar = Bar_val (barv);
  uint64_t position = Int64_val (positionv);
  uint64_t total = Int64_val (totalv);

  progress_bar_set (bar, position, total);

  return Val_unit;
}
Esempio n. 2
0
static void
update_progress_window(struct mpdclient *c, bool repaint)
{
	unsigned elapsed, duration;

	if (c->status == NULL)
		elapsed = 0;
	else if (seek_id >= 0 && seek_id == mpd_status_get_song_id(c->status))
		elapsed = seek_target_time;
	else
		elapsed = mpd_status_get_elapsed_time(c->status);

	duration = mpdclient_is_playing(c)
		? mpd_status_get_total_time(c->status)
		: 0;

	if (progress_bar_set(&screen.progress_bar, elapsed, duration) ||
	    repaint)
		progress_bar_paint(&screen.progress_bar);
}