[gcompris/gcomprixogoo] Added an ongoing progress status at GCompris startup. This is used to avoid the long delay at startu



commit 5171fc6dd54391cef348b43024351df10e32bcc2
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Mon Apr 5 20:04:27 2010 +0200

    Added an ongoing progress status at GCompris startup.
    This is used to avoid the long delay at startup without
    user feedback.

 src/gcompris/Makefile.am   |    2 +
 src/gcompris/gcompris.c    |   67 ++++++++++++++++++++++---------------------
 src/gcompris/gcompris_db.c |    5 +++
 src/gcompris/menu.c        |   20 ++++++++++---
 4 files changed, 56 insertions(+), 38 deletions(-)
---
diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am
index cdf7c66..fec03ce 100644
--- a/src/gcompris/Makefile.am
+++ b/src/gcompris/Makefile.am
@@ -98,6 +98,8 @@ gcompris_SOURCES = \
 	skin.h \
 	soundutil.c \
 	soundutil.h \
+	status.c \
+	status.h \
 	gstreamer.c \
 	soundutil_sdl.c \
 	soundutil_sdl.h \
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index dec8fbd..bcf363f 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -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");
 }
diff --git a/src/gcompris/gcompris_db.c b/src/gcompris/gcompris_db.c
index 133465a..d2f2387 100644
--- a/src/gcompris/gcompris_db.c
+++ b/src/gcompris/gcompris_db.c
@@ -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);
diff --git a/src/gcompris/menu.c b/src/gcompris/menu.c
index 0c8859b..9cf25ee 100644
--- a/src/gcompris/menu.c
+++ b/src/gcompris/menu.c
@@ -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);
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]