예제 #1
0
/** Refresh the progress bar window. */
static void refresh_progress_window(void)
{
  wattrset(application_windows.pProgressWin, A_BOLD);
  mvwprintw(application_windows.pProgressWin, 0, 1, (char *)f_szProgress);
  show_progress_bar();
  wrefresh(application_windows.pProgressWin);
}
예제 #2
0
파일: io.c 프로젝트: davewongillies/gmameui
void
quick_check (void)
{
#ifdef QUICK_CHECK_ENABLED
	static gboolean quick_check_running = FALSE;
	GList *list_pointer;
	gint nb_rom_not_checked;
	gfloat done;
	MameRomEntry *rom;

	GMAMEUI_DEBUG ("Running quick check.");
	if (game_list.num_games == 0)
		return;

	/*prevent user to launch several quick check at the same time */
	if (quick_check_running)
	{
		GMAMEUI_DEBUG ("Quick check already running");
		return;
	}
	quick_check_running = TRUE;
		
	show_progress_bar ();

	nb_rom_not_checked = g_list_length (game_list.not_checked_list);
	g_message (_("Performing quick check, please wait:"));
	/* Disable the callback */
	g_signal_handlers_block_by_func (G_OBJECT (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (main_gui.scrolled_window_games))),
					 (gpointer)adjustment_scrolled, NULL);

	/* need to use the last or I can find the list anymore*/
	for (list_pointer = game_list.not_checked_list;
	     list_pointer;
	     list_pointer = g_list_next (list_pointer))
	{
		rom = (MameRomEntry *)list_pointer->data;

		/* Check for the existence of the ROM; if the ROM is a clone, the
		   parent set must exist as well */
		if (mame_rom_entry_is_clone (rom))
			if ((check_rom_exists_as_file (mame_rom_entry_get_romname (rom))) &&
			    (check_rom_exists_as_file (mame_rom_entry_get_parent_romname (rom))))
			    g_object_set (rom, "has-roms", UNKNOWN, NULL);
			else
			    g_object_set (rom, "has-roms", NOT_AVAIL, NULL);

		else if (check_rom_exists_as_file (mame_rom_entry_get_romname (rom)))
			g_object_set (rom, "has-roms", UNKNOWN, NULL);
		else
			g_object_set (rom, "has-roms", NOT_AVAIL, NULL);


		/* Looking for samples */
		rom->has_samples = 0;

		if (mame_rom_entry_has_samples (rom))
		{
			/* Check for the existence of the samples; if the samples is a clone, the
			   parent set must exist as well */
			if (strcmp (rom->sampleof, "-")) {
				if ((check_rom_exists_as_file (mame_rom_entry_get_romname (rom))) &&
				    (check_rom_exists_as_file (rom->sampleof)))
					g_object_set (rom, "has-samples", CORRECT, NULL);
			} else if (check_rom_exists_as_file (mame_rom_entry_get_romname (rom)))
				g_object_set (rom, "has-samples", CORRECT, NULL);
		}
		
		list_pointer->data = NULL;
		nb_rom_not_checked--;

		done = (gfloat) (game_list.num_games - nb_rom_not_checked) / (gfloat)game_list.num_games;

#if 0
		if (done >= 0.0 && done <= 1.0)
			update_progress_bar (done);
#endif

		/* if the game is in the list, update it */
		if (rom->is_in_list)
			mame_gamelist_view_update_game_in_list (rom);
	}
	g_list_free(game_list.not_checked_list);
	game_list.not_checked_list = NULL;

	hide_progress_bar ();
	quick_check_running= FALSE;
	
	/* Re-Enable the callback */
	g_signal_handlers_unblock_by_func (G_OBJECT (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (main_gui.scrolled_window_games))),
					   (gpointer)adjustment_scrolled, NULL);
#endif
}