Commit 5171fc6d authored by Bruno Coudoin's avatar Bruno Coudoin

Added an ongoing progress status at GCompris startup.

This is used to avoid the long delay at startup without
user feedback.
parent 2a6f86c1
......@@ -98,6 +98,8 @@ gcompris_SOURCES = \
skin.h \
soundutil.c \
soundutil.h \
status.c \
status.h \
gstreamer.c \
soundutil_sdl.c \
soundutil_sdl.h \
......
......@@ -24,8 +24,6 @@
#include <time.h>
#include <string.h>
#include "gcompris.h"
#ifdef WIN32
// WIN32
#elif MAC_INTEGRATION
......@@ -49,6 +47,7 @@
#include "gcompris_config.h"
#include "about.h"
#include "bar.h"
#include "status.h"
#include <locale.h>
#include "binreloc.h"
......@@ -750,8 +749,6 @@ static GcomprisBoard *get_board_to_start()
static void setup_window ()
{
GcomprisBoard *board_to_start;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
/*
......@@ -836,39 +833,11 @@ static void setup_window ()
gc_im_init(window);
gc_board_init();
/* Load all the menu once */
gc_menu_load();
/* Save the root_menu */
properties->menu_board = gc_menu_section_get(properties->root_menu);
init_workspace();
GTK_WIDGET_SET_FLAGS (canvas, GTK_CAN_FOCUS);
gtk_widget_grab_focus (canvas);
/* Run the bar */
gc_bar_start(GTK_CONTAINER(workspace), GOO_CANVAS(canvas));
board_to_start = get_board_to_start();
if(!board_to_start) {
gchar *tmpstr= g_strdup_printf("Couldn't find the board menu %s, or plugin execution error", properties->root_menu);
gc_dialog(tmpstr, NULL);
g_free(tmpstr);
} else if(!gc_board_check_file(board_to_start)) {
gchar *tmpstr= g_strdup_printf("Couldn't find the board menu, or plugin execution error");
gc_dialog(tmpstr, NULL);
g_free(tmpstr);
} else {
g_message("Fine, we got the gcomprisBoardMenu, xml boards parsing went fine");
if(!display_activation_dialog())
gc_board_play(board_to_start);
}
}
#ifdef STATIC_MODULE
......@@ -1182,8 +1151,40 @@ static void map_cb (GtkWidget *widget, gpointer data)
{
if(is_mapped == FALSE)
{
gc_fullscreen_set(properties->fullscreen);
is_mapped = TRUE;
GcomprisBoard *board_to_start;
gc_set_default_background (goo_canvas_get_root_item (GOO_CANVAS(canvas)));
gc_fullscreen_set(properties->fullscreen);
gc_status_init("");
gc_board_init();
/* Load all the menu once */
gc_menu_load();
/* Save the root_menu */
properties->menu_board = gc_menu_section_get(properties->root_menu);
gc_bar_start(GTK_CONTAINER(workspace), GOO_CANVAS(canvas));
gc_status_close();
board_to_start = get_board_to_start();
if(!board_to_start) {
gchar *tmpstr= g_strdup_printf("Couldn't find the board menu %s, or plugin execution error", properties->root_menu);
gc_dialog(tmpstr, NULL);
g_free(tmpstr);
} else if(!gc_board_check_file(board_to_start)) {
gchar *tmpstr= g_strdup_printf("Couldn't find the board menu, or plugin execution error");
gc_dialog(tmpstr, NULL);
g_free(tmpstr);
} else {
g_message("Fine, we got the gcomprisBoardMenu, xml boards parsing went fine");
if(!display_activation_dialog())
gc_board_play(board_to_start);
}
}
g_message("gcompris window is now mapped");
}
......
......@@ -19,6 +19,7 @@
#include <string.h>
#include "gcompris.h"
#include "status.h"
#include <glib/gstdio.h>
#ifdef USE_SQLITE
......@@ -889,6 +890,10 @@ GList *gc_menu_load_db(GList *boards_list)
gcomprisBoard->demo = atoi(result[i++]);
boards = g_list_append(boards, gcomprisBoard);
gchar *msg = g_strdup_printf("Loading activity from database:\n%s",
gettext(gcomprisBoard->title));
gc_status_set_msg(msg);
g_free(msg);
}
sqlite3_free_table(result);
......
......@@ -26,6 +26,7 @@
#include <libxml/parserInternals.h>
#include "gcompris.h"
#include "status.h"
GcomprisBoard *_read_xml_file(GcomprisBoard *gcomprisBoard, char *fname, gboolean db);
......@@ -560,7 +561,7 @@ void gc_menu_load_dir(char *dirname, gboolean db){
gcomprisBoard->previous_board=NULL;
GcomprisBoard *board_read = _read_xml_file(gcomprisBoard, filename, db);
if (board_read){
if (board_read) {
list_old_boards_id = suppress_int_from_list(list_old_boards_id, board_read->board_id);
if (properties->administration)
boards_list = g_list_append(boards_list, board_read);
......@@ -568,12 +569,21 @@ void gc_menu_load_dir(char *dirname, gboolean db){
if ((strncmp(board_read->section,
"/administration",
strlen("/administration"))!=0)) {
boards_list = g_list_append(boards_list, board_read);
}
else
gc_menu_board_free(board_read);
boards_list = g_list_append(boards_list, board_read);
}
else
{
gc_menu_board_free(board_read);
board_read = NULL;
}
}
if (board_read) {
gchar *msg = g_strdup_printf("Loading activity from file:\n%s",
gettext(board_read->title));
gc_status_set_msg(msg);
g_free(msg);
}
}
else
gc_menu_board_free(gcomprisBoard);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment