gcompris r3312 - in branches/gcomprixogoo: . src/boards src/erase-activity src/gcompris



Author: bcoudoin
Date: Sat Mar 15 23:32:33 2008
New Revision: 3312
URL: http://svn.gnome.org/viewvc/gcompris?rev=3312&view=rev

Log:
	merge from trunk r3309
	- It is now possible to add activity introduction voices.
	  If provided, it will be played when the activity starts and when
	  it's help is requested.
	  To provide an activity intro, you must put it under:
	  boards/voices/<locale>/activity/<activity name>-intro.ogg

	* configure.in: removed reference to cairo as goocanvas detects it
	* src/erase-activty/erase.c: (start_board), (end_board),
	(erase_one_item): moved the audio mode PLAY_AND_INTERRUPT only on
	the last item to avoid an intro voice to be cut.
	* src/gcompris/about.c: (gc_about_start): copyright is 2008 now.
	* src/gcompris/board.c: (gc_board_play): added support to play an
	optional intro voice a the start of an activity
	* src/gcompris/help.c: (gc_board_play): added support to play an
	optional intro voice when the help is lanched.
	* src/gcompris/bonus.c: (gc_bonus_display), (bonus_image):
	cleanup, removed extra warnings.
	* src/gcompris/gcompris.c: (cleanup), (single_instance_release),
	(single_instance_check): fixed the release of the lock when GC is exited.
	* src/gcompris/gameutil.c: (gc_activity_intro_play) created this function



Modified:
   branches/gcomprixogoo/ChangeLog
   branches/gcomprixogoo/src/boards/Makefile.am
   branches/gcomprixogoo/src/erase-activity/erase.c
   branches/gcomprixogoo/src/gcompris/about.c
   branches/gcomprixogoo/src/gcompris/board.c
   branches/gcomprixogoo/src/gcompris/bonus.c
   branches/gcomprixogoo/src/gcompris/gameutil.c
   branches/gcomprixogoo/src/gcompris/gameutil.h
   branches/gcomprixogoo/src/gcompris/gcompris.c
   branches/gcomprixogoo/src/gcompris/help.c

Modified: branches/gcomprixogoo/src/boards/Makefile.am
==============================================================================
--- branches/gcomprixogoo/src/boards/Makefile.am	(original)
+++ branches/gcomprixogoo/src/boards/Makefile.am	Sat Mar 15 23:32:33 2008
@@ -16,14 +16,6 @@
 sqlite_cflags =
 endif
 
-if USE_CAIRO
-cairo_ldflags = $(CAIRO_LIBS)
-cairo_cflags = $(CAIRO_CFLAGS)
-else
-cairo_ldflags =
-cairo_cflags =
-endif
-
 if PLATFORM_WIN32
 shared = -shared
 no_undefined = -no-undefined
@@ -52,7 +44,6 @@
 	$(PYTHON_CFLAGS) \
 	$(PYGTK_CFLAGS) \
 	$(sqlite_cflags) \
-	$(cairo_cflags) \
 	$(dll_export)
 
 libmenu_la_LDFLAGS = $(shared) $(no_undefined) -module -avoid-version $(gc_libs)

Modified: branches/gcomprixogoo/src/erase-activity/erase.c
==============================================================================
--- branches/gcomprixogoo/src/erase-activity/erase.c	(original)
+++ branches/gcomprixogoo/src/erase-activity/erase.c	Sat Mar 15 23:32:33 2008
@@ -1,6 +1,6 @@
 /* gcompris - erase.c
  *
- * Copyright (C) 2001 Bruno Coudoin
+ * Copyright (C) 2001, 2008 Bruno Coudoin
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -27,7 +27,6 @@
 
 static GcomprisBoard *gcomprisBoard = NULL;
 static gboolean board_paused = TRUE;
-static SoundPolicy sound_policy;
 static RsvgHandle *CoverPixmap[MAX_LAYERS];
 static gulong event_handle_id;
 
@@ -209,10 +208,6 @@
       gamewon = FALSE;
       pause_board(FALSE);
 
-      /* initial state to restore */
-      sound_policy = gc_sound_policy_get();
-      gc_sound_policy_set(PLAY_AND_INTERRUPT);
-
       GcomprisProperties *properties = gc_prop_get ();
       if(properties->defaultcursor == GCOMPRIS_DEFAULT_CURSOR)
 	{
@@ -250,7 +245,6 @@
       erase_destroy_all_items();
     }
   gcomprisBoard = NULL;
-  gc_sound_policy_set(sound_policy);
 }
 
 /* ======================================= */
@@ -465,6 +459,7 @@
 {
   gdouble screen_x, screen_y;
   int x,y;
+  SoundPolicy sound_policy = gc_sound_policy_get();
 
   goo_canvas_convert_from_item_space(goo_canvas_item_get_canvas(item),
 				     item, &screen_x, &screen_y);
@@ -476,17 +471,26 @@
 
   goo_canvas_item_remove(item);
 
-  if(number_of_items%2)
-    gc_sound_play_ogg ("sounds/eraser1.wav", NULL);
-  else
-    gc_sound_play_ogg ("sounds/eraser2.wav", NULL);
-
   if(--number_of_items == 0)
     {
       gamewon = TRUE;
       erase_destroy_all_items();
       timer_id = gtk_timeout_add (4000, (GtkFunction) bonus, NULL);
     }
+
+  /* force a cleanup of the sound queue */
+  if(number_of_items == 0)
+      gc_sound_policy_set(PLAY_AND_INTERRUPT);
+
+  if(number_of_items%2)
+    gc_sound_play_ogg ("sounds/eraser1.wav", NULL);
+  else
+    gc_sound_play_ogg ("sounds/eraser2.wav", NULL);
+
+  if(number_of_items == 0)
+    gc_sound_policy_set(sound_policy);
+
+
   normal_delay_id = 0;
   return FALSE;
 }

Modified: branches/gcomprixogoo/src/gcompris/about.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/about.c	(original)
+++ branches/gcomprixogoo/src/gcompris/about.c	Sat Mar 15 23:32:33 2008
@@ -218,7 +218,7 @@
 
   // Copyright
   item = goo_canvas_text_new (rootitem,
-			      "Copyright 2000-2007 Bruno Coudoin and Others",
+			      "Copyright 2000-2008 Bruno Coudoin and Others",
 			      (gdouble)  BOARDWIDTH/2,
 			      (gdouble)  y - 95,
 			      -1,

Modified: branches/gcomprixogoo/src/gcompris/board.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/board.c	(original)
+++ branches/gcomprixogoo/src/gcompris/board.c	Sat Mar 15 23:32:33 2008
@@ -369,6 +369,8 @@
       /* Force the bar to go on top of the activities canvas items */
       gc_bar_hide (FALSE);
 
+      gc_activity_intro_play(gcomprisBoard);
+
       return;
     }
 

Modified: branches/gcomprixogoo/src/gcompris/bonus.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/bonus.c	(original)
+++ branches/gcomprixogoo/src/gcompris/bonus.c	Sat Mar 15 23:32:33 2008
@@ -199,9 +199,7 @@
 
   g_assert(bonus_id < GC_BONUS_LAST);
 
-  g_warning("bar_hide...");
   gc_bar_hide(TRUE);
-  g_warning("bar_hide... ok");
 
   if (bonus_display_running) {
     g_warning("error bonus_display_running !");
@@ -236,9 +234,7 @@
   }
 
   /* First pause the board */
-  g_warning("Pausing board ...");
   gc_board_pause(TRUE);
-  g_warning("Pausing board ...ok");
 
   if(bonus_id==GC_BONUS_RANDOM)
     bonus_id = RAND(1, GC_BONUS_LAST);
@@ -273,14 +269,10 @@
   int x,y;
   GdkPixbuf *pixmap = NULL;
 
-  g_warning("Bonus_image: gc_board_get_current...");
-
   GcomprisBoard *gcomprisBoard = gc_board_get_current();
 
   g_assert(gcomprisBoard);
 
-  g_warning("Bonus_image: gc_board_get_current... ok");
-
   /* check that bonus_group is a singleton */
   if (bonus_group != NULL) {
     bonus_display_running = FALSE;

Modified: branches/gcomprixogoo/src/gcompris/gameutil.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/gameutil.c	(original)
+++ branches/gcomprixogoo/src/gcompris/gameutil.c	Sat Mar 15 23:32:33 2008
@@ -1,6 +1,6 @@
 /* gcompris - gameutil.c
  *
- * Copyright (C) 2000-2006 Bruno Coudoin
+ * Copyright (C) 2000, 2008 Bruno Coudoin
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -661,3 +661,21 @@
 
   return(g_mkdir(rootdir, 0755));
 }
+
+
+/** Play the activity intro voice
+ *
+ * \param gcomprisboard
+ *
+ * return void
+ */
+void
+gc_activity_intro_play (GcomprisBoard *gcomprisBoard)
+{
+  gchar *str;
+
+  str = gc_file_find_absolute("voices/$LOCALE/activity/%s-intro.ogg",
+			      gcomprisBoard->name, NULL);
+  gc_sound_play_ogg(str, NULL);
+  g_free(str);
+}

Modified: branches/gcomprixogoo/src/gcompris/gameutil.h
==============================================================================
--- branches/gcomprixogoo/src/gcompris/gameutil.h	(original)
+++ branches/gcomprixogoo/src/gcompris/gameutil.h	Sat Mar 15 23:32:33 2008
@@ -1,6 +1,6 @@
 /* gcompris - gameutil.h
  *
- * Copyright (C) 2000 Bruno Coudoin
+ * Copyright (C) 2000, 2008 Bruno Coudoin
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -62,4 +62,5 @@
 gchar		 *gc_file_find_absolute(const gchar *filename, ...);
 int               gc_util_create_rootdir (gchar *rootdir);
 
+void		 gc_activity_intro_play (GcomprisBoard *gcomprisBoard);
 #endif

Modified: branches/gcomprixogoo/src/gcompris/gcompris.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/gcompris.c	(original)
+++ branches/gcomprixogoo/src/gcompris/gcompris.c	Sat Mar 15 23:32:33 2008
@@ -52,7 +52,6 @@
 static double zoom_factor = 1.0;
 
 /* Multiple instance check */
-static gchar *lock_file;
 #define GC_LOCK_FILE "gcompris.lock"
 #define GC_LOCK_LIMIT 30 /* seconds */
 
@@ -77,6 +76,7 @@
 					    GdkEventKey *event,
 					    gpointer     client_data);
 void gc_terminate(int signum);
+static void single_instance_release();
 
 /*
  * For the Activation dialog
@@ -1011,12 +1011,12 @@
   signal(SIGINT,  NULL);
   signal(SIGSEGV, NULL);
 
+  single_instance_release(); /* Must be done before property destroy */
   gc_board_stop();
   gc_db_exit();
   gc_fullscreen_set(FALSE);
   gc_menu_destroy();
   gc_prop_destroy(gc_prop_get());
-  g_unlink(lock_file);
 }
 
 void gc_exit()
@@ -1232,9 +1232,18 @@
 
 /* Single instance Check */
 static void
+single_instance_release()
+{
+  gchar *lock_file = g_strdup_printf("%s/%s", properties->config_dir, GC_LOCK_FILE);
+
+  g_unlink(lock_file);
+  g_free(lock_file);
+}
+
+static void
 single_instance_check()
 {
-  lock_file = g_strdup_printf("%s/%s", properties->config_dir, GC_LOCK_FILE);
+  gchar *lock_file = g_strdup_printf("%s/%s", properties->config_dir, GC_LOCK_FILE);
   if(!popt_nolockcheck)
     {
       GTimeVal current_time;

Modified: branches/gcomprixogoo/src/gcompris/help.c
==============================================================================
--- branches/gcomprixogoo/src/gcompris/help.c	(original)
+++ branches/gcomprixogoo/src/gcompris/help.c	Sat Mar 15 23:32:33 2008
@@ -1,6 +1,6 @@
 /* gcompris - help.c
  *
- * Copyright (C) 2000 Bruno Coudoin
+ * Copyright (C) 2000, 2008 Bruno Coudoin
  *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
@@ -103,6 +103,8 @@
 
   gc_board_pause(TRUE);
 
+  gc_activity_intro_play(gcomprisBoard);
+
   item_selected = NULL;
   item_selected_text = NULL;
 



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