- open splash screen with progress bar when clicking the "scan now" button

git-svn-id: http://svn.code.sf.net/p/xqf/code/trunk@673 d2ac09be-c843-0410-8b1f-f8a84130e0ec
This commit is contained in:
Ludwig Nussel 2004-11-06 23:01:41 +00:00 committed by l-n
parent 7c65a3c625
commit 38d8b68e84
3 changed files with 31 additions and 19 deletions

View File

@ -1,3 +1,6 @@
Nov 06, 2004: Ludwig Nussel <l-n@users.sourceforge.net>
- open splash screen with progress bar when clicking the "scan now" button
Nov 01, 2004: Ludwig Nussel <l-n@users.sourceforge.net>
- add country statistics
- use an empty flag for countries without flag for proper alignment

View File

@ -51,6 +51,8 @@
static struct generic_prefs* new_generic_prefs (void);
static GtkWidget *custom_args_options_page (enum server_type type);
static void scan_maps_for(enum server_type type);
char *user_rcdir = NULL;
char *default_q1_name = NULL;
@ -3935,14 +3937,15 @@ static GtkWidget *appearance_options_page (void) {
static void scan_maps_callback (GtkWidget *widget, gpointer data)
{
int i;
create_splashscreen();
for (i = 0; i < GAMES_TOTAL; i++)
{
if(games[i].init_maps)
{
debug(0,"Searching for %s maps",games[i].name);
games[i].init_maps(games[i].type);
}
scan_maps_for(i);
}
destroy_splashscreen();
}
static GtkWidget *general_options_page (void) {
@ -5268,28 +5271,34 @@ int prefs_load (void) {
for (i = 0; i < GAMES_TOTAL; i++)
{
// translator: %s = game name, e.g. Quake 3 Arena
char* msg = g_strdup_printf(_("Searching for %s maps"),games[i].name);
guint per = 100/GAMES_TOTAL;
g_free (games[i].real_dir);
games[i].real_dir = expand_tilde (games[i].dir);
splash_increase_progress(msg,per);
if(default_auto_maps && games[i].init_maps)
{
games[i].init_maps(games[i].type);
}
if(default_auto_maps)
scan_maps_for(i);
if(games[i].cmd_or_dir_changed)
games[i].cmd_or_dir_changed(&games[i]);
g_free(msg);
}
return newversion;
}
static void scan_maps_for(enum server_type type)
{
// translator: %s = game name, e.g. Quake 3 Arena
char* msg = g_strdup_printf(_("Searching for %s maps"),games[type].name);
guint per = 100/GAMES_TOTAL;
splash_increase_progress(msg,per);
if(games[type].init_maps)
{
games[type].init_maps(games[type].type);
}
g_free(msg);
}
/*
void prefs_save (void) {
config_push_prefix ("/" CONFIG_FILE "/Preferences");

View File

@ -35,6 +35,7 @@
#include "xutils.h"
static GtkWidget* splashscreen;
static guint current_progress;
void destroy_splashscreen(void)
{
@ -109,10 +110,9 @@ void create_splashscreen (void)
while (gdk_events_pending())
gdk_flush();
current_progress = 0;
}
static guint current_progress;
/* set percentage on splash screen, thanks to lopster for this code */
void splash_set_progress(const char* message, guint per)
{