[gcompris/gcomprixogoo] Added the number of activities in the main menu view.



commit c99b3388d28b7131332a6f4d9f9b1f46fcd67be8
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Sat Jun 12 22:37:51 2010 +0200

    Added the number of activities in the main menu view.

 src/boards/menu2.c   |   16 ++++++++++++++++
 src/gcompris/board.c |   26 ++++++++++++++++++++++++++
 src/gcompris/board.h |    1 +
 3 files changed, 43 insertions(+), 0 deletions(-)
---
diff --git a/src/boards/menu2.c b/src/boards/menu2.c
index 9250523..97cdf1d 100644
--- a/src/boards/menu2.c
+++ b/src/boards/menu2.c
@@ -262,6 +262,22 @@ static void menu_start (GcomprisBoard *agcomprisBoard)
       else
 	display_welcome(menuitems);
 
+      {
+	gchar *text = g_strdup_printf(_("Number of activities: %d"),
+				      gc_board_get_number_of_activity());
+	goo_canvas_text_new (boardRootItem,
+			     text,
+			     BOARDWIDTH - 10,
+			     BOARDHEIGHT - 10,
+			   -1,
+			   GTK_ANCHOR_EAST,
+			   "font", gc_skin_font_board_tiny,
+			   "fill-color-rgba", gc_skin_get_color("menu/text"),
+			   "alignment", PANGO_ALIGN_RIGHT,
+			   NULL);
+	g_free(text);
+      }
+
       menu_pause(FALSE);
 
     }
diff --git a/src/gcompris/board.c b/src/gcompris/board.c
index b48e8d2..a840ad0 100644
--- a/src/gcompris/board.c
+++ b/src/gcompris/board.c
@@ -481,3 +481,29 @@ void gc_board_run_next(GcomprisBoard *board)
 					  NULL);
 
 }
+
+guint gc_board_get_number_of_activity()
+{
+  GList *list;
+  guint board_count = 0;
+#ifdef ACTIVATION_CODE
+  GcomprisProperties	*properties = gc_prop_get();
+#endif
+
+  /* Count non menu boards */
+  for (list = gc_menu_get_boards(); list != NULL; list = list->next)
+    {
+      GcomprisBoard *board = list->data;
+      if (strcmp(board->type, "menu") != 0 &&
+	  strncmp(board->section, "/experimental", 13) != 0)
+	{
+#ifdef ACTIVATION_CODE
+	  if ( !board->demo && gc_activation_check(properties->key) <= 0 )
+	    continue;
+#endif
+
+	  board_count++;
+	}
+    }
+  return board_count;
+}
diff --git a/src/gcompris/board.h b/src/gcompris/board.h
index 02d3ae9..9073bc7 100644
--- a/src/gcompris/board.h
+++ b/src/gcompris/board.h
@@ -65,5 +65,6 @@ void		 gc_board_stop(void);
 void		 gc_board_pause(int pause);
 
 void             gc_board_run_next(GcomprisBoard *board);
+guint		 gc_board_get_number_of_activity();
 
 #endif



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