Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/gcompris
diff options
context:
space:
mode:
authorBruno Coudoin <bcoudoin@src.gnome.org>2008-04-12 21:56:35 (GMT)
committer Bruno Coudoin <bcoudoin@src.gnome.org>2008-04-12 21:56:35 (GMT)
commitb79eec5886e3c696602b54b1847faaf018585766 (patch)
treed6be7a5b66d50b458eca8f283b3618af0dc7e190 /src/gcompris
parent04a84aceb52ff338ca634f25a7c5990bde22f338 (diff)
Improved the windows version so that the administration module
is available in the demo version. Now python activities can be part of the demo version and many are there now. There are now 47 activities in the demo out of 107, more than twice as before. * src/gcompris/board.c: (gc_board_init), (gc_board_check_file): * src/gcompris/gcompris.c: (get_board_to_start), (setup_window), (display_activation_dialog), (activation_done): svn path=/trunk/; revision=3362
Diffstat (limited to 'src/gcompris')
-rw-r--r--src/gcompris/board.c38
-rw-r--r--src/gcompris/gcompris.c122
2 files changed, 100 insertions, 60 deletions
diff --git a/src/gcompris/board.c b/src/gcompris/board.c
index 5a0a4e2..2bd2b24 100644
--- a/src/gcompris/board.c
+++ b/src/gcompris/board.c
@@ -77,10 +77,19 @@ extern BoardPlugin * get_wordprocessor_bplugin_info();
static BoardPlugin *static_boards_demo[MAX_NUMBER_OF_BOARDS];
static BoardPlugin *static_boards[MAX_NUMBER_OF_BOARDS];
-#endif
+static char *board_nodemo[] = /* Some boards excluded from the demo version */
+ {
+ "python:ballcatch",
+ "python:followline",
+ "python:guessnumber",
+ "python:mosaic",
+ "python:redraw",
+ "python:searace",
+ "python:sudoku",
+ "python:watercycle",
+ NULL
+ };
-#ifdef STATIC_MODULE
-int gc_board_number_in_demo;
void gc_board_init(void)
{
guint i=0;
@@ -104,6 +113,7 @@ void gc_board_init(void)
static_boards_demo[i++] = get_menu_bplugin_info();
static_boards_demo[i++] = get_money_bplugin_info();
static_boards_demo[i++] = get_reading_bplugin_info();
+ static_boards_demo[i++] = get_python_bplugin_info();
static_boards_demo[i++] = get_scale_bplugin_info();
static_boards_demo[i++] = get_submarine_bplugin_info();
static_boards_demo[i++] = get_superbrain_bplugin_info();
@@ -111,8 +121,6 @@ void gc_board_init(void)
static_boards_demo[i++] = get_wordprocessor_bplugin_info();
static_boards_demo[i++] = NULL;
- gc_board_number_in_demo = i - 2;
-
i=0;
static_boards[i++] = get_advanced_colors_bplugin_info();
@@ -222,7 +230,10 @@ gc_board_check_file(GcomprisBoard *gcomprisBoard)
return TRUE;
}
- key_is_valid = gc_activation_check(properties->key);
+ if(properties->administration)
+ key_is_valid = 1;
+ else
+ key_is_valid = gc_activation_check(properties->key);
i = 0;
if(key_is_valid == 1)
@@ -252,6 +263,19 @@ gc_board_check_file(GcomprisBoard *gcomprisBoard)
if(bp->is_our_board(gcomprisBoard)) {
/* Great, we found our plugin */
+
+ /* check for excluded one */
+ char **ptr = board_nodemo;
+ do
+ {
+ if(strcmp(*ptr, gcomprisBoard->type) == 0)
+ break;
+ }
+ while(*++ptr);
+
+ if(*ptr)
+ goto notfound;
+
g_warning("We found the correct plugin for board %s (type=%s)\n",
gcomprisBoard->name, gcomprisBoard->type);
@@ -262,6 +286,8 @@ gc_board_check_file(GcomprisBoard *gcomprisBoard)
}
}
+ notfound:
+ gcomprisBoard->plugin = NULL;
g_warning("No plugin library found for board type '%s', requested by '%s'",
gcomprisBoard->type, gcomprisBoard->filename);
diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c
index 31d36de..165bcb3 100644
--- a/src/gcompris/gcompris.c
+++ b/src/gcompris/gcompris.c
@@ -77,11 +77,11 @@ int gc_activation_check(char *code);
static void activation_enter_callback(GtkWidget *widget,
GtkWidget *entry );
static void activation_done();
-static void display_activation_dialog();
+static int display_activation_dialog();
static GnomeCanvasItem *activation_item;
static GtkEntry *widget_activation_entry;
#else
-#define display_activation_dialog()
+#define display_activation_dialog() FALSE
#endif
@@ -608,6 +608,53 @@ void gc_cursor_set(guint gdk_cursor_type)
}
}
+static GcomprisBoard *get_board_to_start()
+{
+ GcomprisBoard *board_to_start;
+
+ /* By default, the menu will be started */
+ board_to_start = properties->menu_board;
+
+ /* Get and Run the root menu */
+ if(properties->administration)
+ {
+ board_to_start = gc_menu_section_get("/administration/administration");
+ }
+ else
+ {
+ /* If we have a profile defined, run the login screen
+ * (the login screen is a board that uppon login completion
+ * starts the menu)
+ */
+ if(properties->profile && properties->profile->group_ids)
+ {
+ gboolean found = FALSE;
+
+ GList *group_id;
+
+ for (group_id = properties->profile->group_ids; group_id != NULL; group_id = group_id->next)
+ if (g_list_length(gc_db_users_from_group_get( *((int *) group_id->data))) > 0){
+ found = TRUE;
+ break;
+ }
+
+ /* No profile start normally */
+ if (found)
+ board_to_start = gc_menu_section_get("/login/login");
+ else {
+ board_to_start = gc_menu_section_get(properties->root_menu);
+ /* this will set user information to system one */
+ gc_profile_set_current_user(NULL);
+ }
+ }
+ else
+ /* this will set user information to system one */
+ gc_profile_set_current_user(NULL);
+ }
+
+ return board_to_start;
+}
+
static void setup_window ()
{
GcomprisBoard *board_to_start;
@@ -733,51 +780,13 @@ static void setup_window ()
/* Save the root_menu */
properties->menu_board = gc_menu_section_get(properties->root_menu);
- /* By default, the menu will be started */
- board_to_start = properties->menu_board;
-
- /* Get and Run the root menu */
- if(properties->administration)
- {
- board_to_start = gc_menu_section_get("/administration/administration");
- }
- else
- {
- /* If we have a profile defined, run the login screen
- * (the login screen is a board that uppon login completion
- * starts the menu)
- */
- if(properties->profile && properties->profile->group_ids)
- {
- gboolean found = FALSE;
-
- GList *group_id;
-
- for (group_id = properties->profile->group_ids; group_id != NULL; group_id = group_id->next)
- if (g_list_length(gc_db_users_from_group_get( *((int *) group_id->data))) > 0){
- found = TRUE;
- break;
- }
-
- /* No profile start normally */
- if (found)
- board_to_start = gc_menu_section_get("/login/login");
- else {
- board_to_start = gc_menu_section_get(properties->root_menu);
- /* this will set user information to system one */
- gc_profile_set_current_user(NULL);
- }
- }
- else
- /* this will set user information to system one */
- gc_profile_set_current_user(NULL);
- }
-
- /* Run the bar */
+ /* Run the bar */
gc_bar_start(canvas_bar);
init_background();
+ 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);
@@ -788,38 +797,43 @@ static void setup_window ()
g_free(tmpstr);
} else {
g_warning("Fine, we got the gcomprisBoardMenu, xml boards parsing went fine");
- gc_board_play(board_to_start);
+ if(!display_activation_dialog())
+ gc_board_play(board_to_start);
}
- display_activation_dialog();
}
#ifdef STATIC_MODULE
-extern int gc_board_number_in_demo;
/** Display the activation dialog for the windows version
*
+ * return TRUE is the dialog is display, FALSE instead.
*/
-void
+int
display_activation_dialog()
{
int board_count = 0;
+ int gc_board_number_in_demo = 0;
GList *list;
guint key_is_valid = 0;
key_is_valid = gc_activation_check(properties->key);
if(key_is_valid == 1)
- return;
+ return FALSE;
/* 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 &&
- strcmp(board->section, "/experimental") != 0 &&
- strcmp(board->section, "/administration") != 0)
- board_count++;
+ strncmp(board->section, "/experimental", 13) != 0)
+ {
+ board_count++;
+ gc_board_check_file(board);
+ if(board->plugin)
+ gc_board_number_in_demo++;
+ }
}
/* Entry area */
@@ -843,12 +857,12 @@ display_activation_dialog()
gtk_widget_show(GTK_WIDGET(widget_activation_entry));
gtk_entry_set_text(GTK_ENTRY(widget_activation_entry), "CODE");
- gc_board_stop();
-
char *msg = g_strdup_printf(_("GCompris is free software released under the GPL License. In order to support its development, the Windows version provides only %d of the %d activities. You can get the full version for a small fee at\n<http://gcompris.net>\nThe GNU/Linux version does not have this restriction. Note that GCompris is being developed to free schools from monopolistic software vendors. If you also believe that we should teach freedom to children, please consider using GNU/Linux. Get more information at FSF:\n<http://www.fsf.org/philosophy>"),
gc_board_number_in_demo, board_count);
gc_dialog(msg, activation_done);
g_free(msg);
+
+ return TRUE;
}
/**
@@ -941,7 +955,7 @@ activation_done()
activation_enter_callback(GTK_WIDGET(widget_activation_entry), NULL);
}
- gc_board_play(properties->menu_board);
+ gc_board_play( get_board_to_start());
gtk_object_destroy (GTK_OBJECT(activation_item));
}
#endif