diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-03-02 23:15:54 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-03-02 23:15:54 (GMT) |
commit | dfd058594ed01fa3334f0a97a1c5afd06ea02972 (patch) | |
tree | ceae3e3a7ad18d8cc0d15ad63539f3e1984de18d | |
parent | 0efd36e66326eb6a04180d87c19dea62032f690a (diff) |
- removed many warnings
- added two options from the command line to use GCompris in a kiosk mode.
--disable-quit Disable the quit button
--disable-config Disable the config button
-rw-r--r-- | ChangeLog | 31 | ||||
-rw-r--r-- | src/boards/algebra.c | 6 | ||||
-rw-r--r-- | src/boards/awele.c | 19 | ||||
-rw-r--r-- | src/boards/awele.h | 2 | ||||
-rw-r--r-- | src/boards/menu2.c | 8 | ||||
-rw-r--r-- | src/gcompris/bar.c | 106 | ||||
-rw-r--r-- | src/gcompris/cursor.c | 4 | ||||
-rw-r--r-- | src/gcompris/gameutil.c | 86 | ||||
-rw-r--r-- | src/gcompris/gcompris.c | 24 | ||||
-rw-r--r-- | src/gcompris/gcompris.h | 3 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.c | 4 | ||||
-rw-r--r-- | src/gcompris/gcompris_db.h | 6 | ||||
-rw-r--r-- | src/gcompris/images_selector.c | 24 | ||||
-rw-r--r-- | src/gcompris/properties.c | 18 | ||||
-rw-r--r-- | src/gcompris/properties.h | 4 | ||||
-rw-r--r-- | src/gcompris/skin.c | 14 |
16 files changed, 208 insertions, 151 deletions
@@ -1,3 +1,34 @@ +2006-03-03 Bruno coudoin <bruno.coudoin@free.fr> + + - removed many warnings + - added two options from the command line to use GCompris in a kiosk mode. + --disable-quit Disable the quit button + --disable-config Disable the config button + + + * src/boards/algebra.c: (algebra_create_item): + * src/boards/awele.c: (pause_board), (awele_next_level), + (buttonClick): + * src/boards/awele.h: + * src/boards/menu2.c: (display_welcome): + * src/gcompris/bar.c: (gcompris_bar_start), (gcompris_bar_set), + (gcompris_bar_hide), (update_exit_button), (item_event_bar), + (confirm_quit): + * src/gcompris/cursor.c: (gdk_cursor_new_from_data): + * src/gcompris/gameutil.c: (reactivate_newline), + (gcompris_add_xml_to_data), (gcompris_read_xml_file), + (gcompris_display_difficulty_stars): + * src/gcompris/gcompris.c: (gcompris_terminate), (gcompris_init): + * src/gcompris/gcompris.h: + * src/gcompris/gcompris_db.c: (gcompris_db_board_update): + * src/gcompris/gcompris_db.h: + * src/gcompris/images_selector.c: (parseImage), (read_xml_file), + (read_dataset_directory): + * src/gcompris/properties.c: (gcompris_properties_new), + (gcompris_properties_save): + * src/gcompris/properties.h: + * src/gcompris/skin.c: (gcompris_skin_xml_load): + 2006-03-01 Bruno coudoin <bruno.coudoin@free.fr> *** MERGE OF BRANCH gcompris_7_4 *** diff --git a/src/boards/algebra.c b/src/boards/algebra.c index 44305cb..040eedd 100644 --- a/src/boards/algebra.c +++ b/src/boards/algebra.c @@ -1,6 +1,6 @@ /* gcompris - algebra.c * - * Time-stamp: <2005/10/12 23:24:20 bruno> + * Time-stamp: <2006/03/02 00:38:14 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -20,6 +20,7 @@ */ #include <ctype.h> +#include <string.h> #include "gcompris/gcompris.h" @@ -512,7 +513,8 @@ static void display_operand(GnomeCanvasGroup *parent, static GnomeCanvasItem *algebra_create_item(GnomeCanvasGroup *parent) { GnomeCanvasItem *item; - guint first_operand, second_operand; + guint first_operand = 0; + guint second_operand = 0; char *first_operand_str = NULL; char *second_operand_str = NULL; char *audioOperand = NULL; diff --git a/src/boards/awele.c b/src/boards/awele.c index 30816bd..03c02d8 100644 --- a/src/boards/awele.c +++ b/src/boards/awele.c @@ -105,10 +105,9 @@ static void pause_board (gboolean pause) timeout = g_timeout_add (2000, (GSourceFunc) to_computer, NULL); - anim_item = (GnomeCanvasItem*) - gcompris_activate_animation( boardRootItem, - animation ); - gnome_canvas_item_show(anim_item->canvas); + anim_item = gcompris_activate_animation( boardRootItem, + animation ); + gnome_canvas_item_show(GNOME_CANVAS_ITEM(anim_item->canvas)); } } else{ @@ -260,10 +259,9 @@ awele_next_level () timeout = g_timeout_add (2000, (GSourceFunc) to_computer, NULL); - anim_item = (GnomeCanvasItem*) - gcompris_activate_animation( boardRootItem, - animation ); - gnome_canvas_item_show(anim_item->canvas); + anim_item = gcompris_activate_animation( boardRootItem, + animation ); + gnome_canvas_item_show(GNOME_CANVAS_ITEM(anim_item->canvas)); } else { computer_turn = FALSE; @@ -744,9 +742,8 @@ buttonClick (GtkWidget * item, GdkEvent * event, gpointer data) timeout = g_timeout_add (2000, (GSourceFunc) to_computer, NULL); - anim_item = (GnomeCanvasItem*) - gcompris_activate_animation( boardRootItem, - animation ); + anim_item = gcompris_activate_animation( boardRootItem, + animation ); } } diff --git a/src/boards/awele.h b/src/boards/awele.h index 3c75929..98227e0 100644 --- a/src/boards/awele.h +++ b/src/boards/awele.h @@ -51,8 +51,6 @@ typedef struct { /* * Fonctions de traitement des events, signaux et rappels */ -static gint eventDelete (GtkWidget * widget, GdkEvent *event, gpointer data); -static gint eventDestroy (GtkWidget * widget, GdkEvent *event, gpointer data); static gint buttonClick (GtkWidget *item, GdkEvent *event, gpointer data); /** diff --git a/src/boards/menu2.c b/src/boards/menu2.c index a1f9f1d..9e3223b 100644 --- a/src/boards/menu2.c +++ b/src/boards/menu2.c @@ -1,6 +1,6 @@ /* gcompris - menu2.c * - * Time-stamp: <2006/01/29 20:15:14 yves> + * Time-stamp: <2006/03/01 23:18:32 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -1000,11 +1000,11 @@ static void display_welcome (void) && G_IS_OBJECT(menuitems->description_item_s)) set_content(menuitems->description_item, menuitems->description_item_s, - _("GCompris is a collection of educational games that provides for children from 2 years old with different activities.")); + _("GCompris is a collection of educational games that provides different activities for children aged 2 and up.")); if(G_IS_OBJECT(menuitems->author_item)) gnome_canvas_item_set (menuitems->author_item, - "text", _("Bruno Coudoin, Genius"), + "text", "", NULL); if(G_IS_OBJECT(menuitems->boardname_item_s)) gnome_canvas_item_set (menuitems->boardname_item_s, @@ -1013,7 +1013,7 @@ static void display_welcome (void) if(G_IS_OBJECT(menuitems->author_item_s)) gnome_canvas_item_set (menuitems->author_item_s, - "text", _("Bruno Coudoin, Genius"), + "text", "", NULL); } diff --git a/src/gcompris/bar.c b/src/gcompris/bar.c index 5433dcb..aab4ddd 100644 --- a/src/gcompris/bar.c +++ b/src/gcompris/bar.c @@ -1,6 +1,6 @@ /* gcompris - bar.c * - * Time-stamp: <2006/03/01 01:05:02 bruno> + * Time-stamp: <2006/03/02 23:27:13 bruno> * * Copyright (C) 2000-2003 Bruno Coudoin * @@ -54,7 +54,7 @@ static guint level_handler_id; static gint sound_play_id = 0; -void confirm_quit(gboolean answer); +static void confirm_quit(gboolean answer); /* * Main entry point @@ -68,7 +68,7 @@ void confirm_quit(gboolean answer); */ void gcompris_bar_start (GnomeCanvas *theCanvas) { - + GcomprisProperties *properties = gcompris_get_properties(); GdkPixbuf *pixmap = NULL; GnomeCanvasItem *rootitem; gint16 width, height; @@ -96,25 +96,27 @@ void gcompris_bar_start (GnomeCanvas *theCanvas) gdk_pixbuf_unref(pixmap); // EXIT - pixmap = gcompris_load_skin_pixmap("button_exit.png"); - zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap); - exit_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem), - gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, - "x", (double) (width/NUMBER_OF_ITEMS) * 1 - - gdk_pixbuf_get_width(pixmap)/2, - "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2, - NULL); - gdk_pixbuf_unref(pixmap); - - gtk_signal_connect(GTK_OBJECT(exit_item), "event", - (GtkSignalFunc) item_event_bar, - "quit"); + if(properties->disable_quit == 0) + { + pixmap = gcompris_load_skin_pixmap("button_exit.png"); + zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap); + exit_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem), + gnome_canvas_pixbuf_get_type (), + "pixbuf", pixmap, + "x", (double) (width/NUMBER_OF_ITEMS) * 1 - + gdk_pixbuf_get_width(pixmap)/2, + "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2, + NULL); + gdk_pixbuf_unref(pixmap); - gtk_signal_connect(GTK_OBJECT(exit_item), "event", - (GtkSignalFunc) gcompris_item_event_focus, - NULL); + gtk_signal_connect(GTK_OBJECT(exit_item), "event", + (GtkSignalFunc) item_event_bar, + "quit"); + gtk_signal_connect(GTK_OBJECT(exit_item), "event", + (GtkSignalFunc) gcompris_item_event_focus, + NULL); + } // HOME pixmap = gcompris_load_skin_pixmap("home.png"); @@ -220,24 +222,27 @@ void gcompris_bar_start (GnomeCanvas *theCanvas) NULL); // CONFIG - pixmap = gcompris_load_skin_pixmap("config.png"); - zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap); - config_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem), - gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, - "x", (double) (width/NUMBER_OF_ITEMS) * 3 - - gdk_pixbuf_get_width(pixmap)/2, - "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2, - NULL); - gdk_pixbuf_unref(pixmap); + if(properties->disable_config == 0) + { + pixmap = gcompris_load_skin_pixmap("config.png"); + zoom = (double)(height-BAR_GAP)/(double)gdk_pixbuf_get_height(pixmap); + config_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem), + gnome_canvas_pixbuf_get_type (), + "pixbuf", pixmap, + "x", (double) (width/NUMBER_OF_ITEMS) * 3 - + gdk_pixbuf_get_width(pixmap)/2, + "y", (double) (height-gdk_pixbuf_get_height(pixmap)*zoom)/2, + NULL); + gdk_pixbuf_unref(pixmap); - gtk_signal_connect(GTK_OBJECT(config_item), "event", - (GtkSignalFunc) item_event_bar, - "configuration"); + gtk_signal_connect(GTK_OBJECT(config_item), "event", + (GtkSignalFunc) item_event_bar, + "configuration"); - gtk_signal_connect(GTK_OBJECT(config_item), "event", - (GtkSignalFunc) gcompris_item_event_focus, - NULL); + gtk_signal_connect(GTK_OBJECT(config_item), "event", + (GtkSignalFunc) gcompris_item_event_focus, + NULL); + } // ABOUT pixmap = gcompris_load_skin_pixmap("about.png"); @@ -265,7 +270,8 @@ void gcompris_bar_start (GnomeCanvas *theCanvas) gnome_canvas_item_show(ok_item); gnome_canvas_item_show(help_item); gnome_canvas_item_show(repeat_item); - gnome_canvas_item_show(config_item); + if(config_item) + gnome_canvas_item_show(config_item); gnome_canvas_item_show(about_item); } @@ -364,7 +370,7 @@ gcompris_bar_set (const GComprisBarFlags flags) gnome_canvas_item_hide(repeat_item); } - if(flags&GCOMPRIS_BAR_CONFIG) + if(flags&GCOMPRIS_BAR_CONFIG && config_item) gnome_canvas_item_show(config_item); else gnome_canvas_item_hide(config_item); @@ -387,13 +393,15 @@ gcompris_bar_hide (gboolean hide) { if(hide) { - gnome_canvas_item_hide(exit_item); + if(exit_item) + gnome_canvas_item_hide(exit_item); gnome_canvas_item_hide(home_item); gnome_canvas_item_hide(level_item); gnome_canvas_item_hide(ok_item); gnome_canvas_item_hide(help_item); gnome_canvas_item_hide(repeat_item); - gnome_canvas_item_hide(config_item); + if(config_item) + gnome_canvas_item_hide(config_item); gnome_canvas_item_hide(about_item); } else @@ -420,12 +428,14 @@ static void update_exit_button() if (get_current_gcompris_board()->previous_board == NULL) { /* We are in the upper menu: show it */ - gnome_canvas_item_show(exit_item); + if(exit_item) + gnome_canvas_item_show(exit_item); gnome_canvas_item_hide(home_item); } else { - gnome_canvas_item_hide(exit_item); + if(exit_item) + gnome_canvas_item_hide(exit_item); gnome_canvas_item_show(home_item); } } @@ -558,11 +568,10 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data) } else if(!strcmp((char *)data, "quit")) { - //gcompris_exit(); - gcompris_confirm( "GCompris confirmation", - "Sure you want to quit ?", - "Yes, i am sure !", - "No, i am Bruno\'s daughter", + gcompris_confirm( _("GCompris confirmation"), + _("Sure you want to quit ?"), + _("Yes, I am sure !"), + _("No, I continue"), (ConfirmCallBack) confirm_quit); } break; @@ -574,7 +583,8 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data) } -void confirm_quit(gboolean answer) +static void +confirm_quit(gboolean answer) { if (answer) gcompris_exit(); diff --git a/src/gcompris/cursor.c b/src/gcompris/cursor.c index d09ee9c..a7c4c1b 100644 --- a/src/gcompris/cursor.c +++ b/src/gcompris/cursor.c @@ -62,7 +62,7 @@ GdkCursor *gdk_cursor_new_from_data(const gchar *bits[], } if (j%8) *ptr++ >>= 8-j%8; } - bitmap = gdk_bitmap_create_from_data(NULL, data, width, height); + bitmap = gdk_bitmap_create_from_data(NULL, (gchar *)data, width, height); /* Build mask */ ptr = data; @@ -73,7 +73,7 @@ GdkCursor *gdk_cursor_new_from_data(const gchar *bits[], } if (j%8) *ptr++ >>= 8-j%8; } - mask = gdk_bitmap_create_from_data(NULL, data, width, height); + mask = gdk_bitmap_create_from_data(NULL, (gchar *)data, width, height); /* Build cursor from bitmap and mask */ cursor = gdk_cursor_new_from_pixmap(bitmap, mask, /* Image and mask */ diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c index 618d2ac..0183e29 100644 --- a/src/gcompris/gameutil.c +++ b/src/gcompris/gameutil.c @@ -1,6 +1,6 @@ /* gcompris - gameutil.c * - * Time-stamp: <2006/01/20 10:06:29 yves> + * Time-stamp: <2006/03/02 00:30:53 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -375,12 +375,12 @@ gchar *reactivate_newline(char *str) - newstr = xmlStringDecodeEntities (ctxt, - str, - XML_SUBSTITUTE_REF, - 0, - 0, - 0); + newstr = (gchar *)xmlStringDecodeEntities (ctxt, + BAD_CAST str, + XML_SUBSTITUTE_REF, + 0, + 0, + 0); xmlFreeParserCtxt (ctxt); @@ -408,23 +408,23 @@ gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, Gcomp if(/* if the node has no name */ !xmlnode->name || /* or if the name is not "Board" */ - (g_strcasecmp(xmlnode->name,"Board")!=0) + (g_strcasecmp((char *)xmlnode->name,"Board")!=0) ) return; /* get the type of the board */ - gcomprisBoard->type = xmlGetProp(xmlnode,"type"); + gcomprisBoard->type = (char *)xmlGetProp(xmlnode, BAD_CAST "type"); /* get the specific mode for this board */ - gcomprisBoard->mode = xmlGetProp(xmlnode,"mode"); - gcomprisBoard->name = xmlGetProp(xmlnode,"name"); - gcomprisBoard->icon_name = xmlGetProp(xmlnode,"icon"); - gcomprisBoard->author = xmlGetProp(xmlnode,"author"); - gcomprisBoard->boarddir = xmlGetProp(xmlnode,"boarddir"); - gcomprisBoard->mandatory_sound_file = xmlGetProp(xmlnode,"mandatory_sound_file"); - gcomprisBoard->mandatory_sound_dataset = xmlGetProp(xmlnode,"mandatory_sound_dataset"); - - gchar *path = xmlGetProp(xmlnode,"section"); + gcomprisBoard->mode = (char *)xmlGetProp(xmlnode, BAD_CAST "mode"); + gcomprisBoard->name = (char *)xmlGetProp(xmlnode, BAD_CAST "name"); + gcomprisBoard->icon_name = (char *)xmlGetProp(xmlnode, BAD_CAST "icon"); + gcomprisBoard->author = (char *)xmlGetProp(xmlnode, BAD_CAST "author"); + gcomprisBoard->boarddir = (char *)xmlGetProp(xmlnode, BAD_CAST "boarddir"); + gcomprisBoard->mandatory_sound_file = (char *)xmlGetProp(xmlnode, BAD_CAST "mandatory_sound_file"); + gcomprisBoard->mandatory_sound_dataset = (char *)xmlGetProp(xmlnode, BAD_CAST "mandatory_sound_dataset"); + + gchar *path = (char *)xmlGetProp(xmlnode, BAD_CAST "section"); if (strlen(path)==1){ g_free(path); path = g_strdup(""); @@ -441,7 +441,7 @@ gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, Gcomp gcomprisBoard->manual = NULL; gcomprisBoard->credit = NULL; - gcomprisBoard->difficulty = xmlGetProp(xmlnode,"difficulty"); + gcomprisBoard->difficulty = (char *)xmlGetProp(xmlnode, BAD_CAST "difficulty"); if(gcomprisBoard->difficulty == NULL) gcomprisBoard->difficulty = "0"; @@ -450,60 +450,60 @@ gcompris_add_xml_to_data(xmlDocPtr doc, xmlNodePtr xmlnode, GNode * child, Gcomp properties->difficulty_max = atoi(gcomprisBoard->difficulty); for (xmlnode = xmlnode->xmlChildrenNode; xmlnode != NULL; xmlnode = xmlnode->next) { - if (xmlHasProp(xmlnode, "lang")) + if (xmlHasProp(xmlnode, BAD_CAST "lang")) continue; /* get the title of the board */ - if (!strcmp(xmlnode->name, "title")) + if (!strcmp((char *)xmlnode->name, "title")) { - title = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + title = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->title = reactivate_newline(gettext(title)); } /* get the description of the board */ - if (!strcmp(xmlnode->name, "description")) + if (!strcmp((char *)xmlnode->name, "description")) { - description = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + description = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->description = reactivate_newline(gettext(description)); } /* get the help prerequisite help of the board */ - if (!strcmp(xmlnode->name, "prerequisite")) + if (!strcmp((char *)xmlnode->name, "prerequisite")) { if(gcomprisBoard->prerequisite) g_free(gcomprisBoard->prerequisite); - prerequisite = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + prerequisite = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->prerequisite = reactivate_newline(gettext(prerequisite)); } /* get the help goal of the board */ - if (!strcmp(xmlnode->name, "goal")) + if (!strcmp((char *)xmlnode->name, "goal")) { if(gcomprisBoard->goal) g_free(gcomprisBoard->goal); - goal = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + goal = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->goal = reactivate_newline(gettext(goal)); } /* get the help user manual of the board */ - if (!strcmp(xmlnode->name, "manual")) + if (!strcmp((char *)xmlnode->name, "manual")) { if(gcomprisBoard->manual) g_free(gcomprisBoard->manual); - manual = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + manual = (char *)xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->manual = reactivate_newline(gettext(manual)); } /* get the help user credit of the board */ - if (!strcmp(xmlnode->name, "credit")) + if (!strcmp((char *)xmlnode->name, "credit")) { if(gcomprisBoard->credit) g_free(gcomprisBoard->credit); - credit = xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); + credit =(char *) xmlNodeListGetString(doc, xmlnode->xmlChildrenNode, 0); gcomprisBoard->credit = reactivate_newline(gettext(credit)); } } @@ -615,7 +615,7 @@ GcomprisBoard *gcompris_read_xml_file(GcomprisBoard *gcomprisBoard, /* if it doesn't have a name */ !doc->children->name || /* if it isn't a GCompris node */ - g_strcasecmp(doc->children->name,"GCompris")!=0) { + g_strcasecmp((char *)doc->children->name,"GCompris")!=0) { xmlFreeDoc(doc); g_free(gcomprisBoard); g_warning("Oops, the file %s is not for gcompris", filename); @@ -1232,16 +1232,16 @@ GnomeCanvasGroup *gcompris_display_difficulty_stars(GnomeCanvasGroup *parent, "y", (double) 0, NULL)); - item = gnome_canvas_item_new (stars_group, - gnome_canvas_pixbuf_get_type (), - "pixbuf", pixmap, - "x", x, - "y", y, - "width", (double) gdk_pixbuf_get_width(pixmap) * ratio, - "height", (double) gdk_pixbuf_get_height(pixmap) * ratio, - "width_set", TRUE, - "height_set", TRUE, - NULL); + item = GNOME_CANVAS_PIXBUF(gnome_canvas_item_new (stars_group, + gnome_canvas_pixbuf_get_type (), + "pixbuf", pixmap, + "x", x, + "y", y, + "width", (double) gdk_pixbuf_get_width(pixmap) * ratio, + "height", (double) gdk_pixbuf_get_height(pixmap) * ratio, + "width_set", TRUE, + "height_set", TRUE, + NULL)); gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) gcompris_item_event_focus, diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c index 68e40e8..a77f96d 100644 --- a/src/gcompris/gcompris.c +++ b/src/gcompris/gcompris.c @@ -117,6 +117,8 @@ static int *popt_profile_list = FALSE; static char *popt_shared_dir = NULL; static char *popt_users_dir = NULL; static int popt_experimental = FALSE; +static int popt_no_quit = FALSE; +static int popt_no_config = FALSE; static struct poptOption options[] = { {"fullscreen", 'f', POPT_ARG_NONE, &popt_fullscreen, 0, @@ -163,6 +165,10 @@ static struct poptOption options[] = { N_("The location of user directories: [$HOME/.gcompris/users]"), NULL}, {"experimental",'\0', POPT_ARG_NONE, &popt_experimental, 0, N_("Run the experimental activities"), NULL}, + {"disable-quit",'\0', POPT_ARG_NONE, &popt_no_quit, 0, + N_("Disable the quit button"), NULL}, + {"disable-config",'\0', POPT_ARG_NONE, &popt_no_config, 0, + N_("Disable the config button"), NULL}, #ifndef WIN32 /* Not supported on windows */ POPT_AUTOHELP #endif @@ -915,14 +921,10 @@ static void map_cb (GtkWidget *widget, gpointer data) * Process the cleanup of the child (no zombies) * --------------------------------------------- */ -void gcompris_terminate(int signum) +void gcompris_terminate(int signum) { -#ifndef WIN32 /* Not supported on windows */ - g_warning("gcompris got the %s signal, starting exit procedure", strsignal(signum)); -#else g_warning("gcompris got the %d signal, starting exit procedure", signum); -#endif gcompris_exit(); @@ -1225,6 +1227,18 @@ gcompris_init (int argc, char *argv[]) properties->experimental = TRUE; } + if (popt_no_quit) + { + g_warning("Disable quit button"); + properties->disable_quit = TRUE; + } + + if (popt_no_config) + { + g_warning("Disable config button"); + properties->disable_config = TRUE; + } + if (popt_difficulty_filter>=0) { /* This option provide less capacity than the GUI since we cannot set the filter_style */ diff --git a/src/gcompris/gcompris.h b/src/gcompris/gcompris.h index 80bee96..ca5b9d4 100644 --- a/src/gcompris/gcompris.h +++ b/src/gcompris/gcompris.h @@ -1,6 +1,6 @@ /* gcompris - gcompris.h * - * Time-stamp: <2006/02/05 08:44:11 yves> + * Time-stamp: <2006/03/02 00:02:09 bruno> * * Copyright (C) 2000,2001,2002 Bruno Coudoin * @@ -97,6 +97,7 @@ typedef enum GCOMPRIS_BAR_CONFIG = 1 << 3, GCOMPRIS_BAR_ABOUT = 1 << 4, GCOMPRIS_BAR_REPEAT_ICON = 1 << 5, + GCOMPRIS_BAR_QUIT = 1 << 6, } GComprisBarFlags; /* Difficulty filtering */ diff --git a/src/gcompris/gcompris_db.c b/src/gcompris/gcompris_db.c index eb10aa5..2145c0b 100644 --- a/src/gcompris/gcompris_db.c +++ b/src/gcompris/gcompris_db.c @@ -430,8 +430,8 @@ gboolean gcompris_db_check_boards() "SELECT board_id FROM boards WHERE name=\'%s\';",n -void gcompris_db_board_update(gint *board_id, - gint *section_id, +void gcompris_db_board_update(guint *board_id, + guint *section_id, gchar *name, gchar *section, gchar *author, diff --git a/src/gcompris/gcompris_db.h b/src/gcompris/gcompris_db.h index d50dff1..a68d60b 100644 --- a/src/gcompris/gcompris_db.h +++ b/src/gcompris/gcompris_db.h @@ -1,6 +1,6 @@ /* gcompris - gcompris_db.h * - * Time-stamp: <2005/09/15 10:06:18 yves> + * Time-stamp: <2006/03/02 00:19:19 bruno> * * Copyright (C) 2005 Bruno Coudoin * @@ -37,8 +37,8 @@ void gcompris_db_set_date(gchar *date); void gcompris_db_set_version(gchar *version); -void gcompris_db_board_update(gint *board_id, - gint *section_id, +void gcompris_db_board_update(guint *board_id, + guint *section_id, gchar *name, gchar *section, gchar *author, diff --git a/src/gcompris/images_selector.c b/src/gcompris/images_selector.c index 7159c60..6ee874a 100644 --- a/src/gcompris/images_selector.c +++ b/src/gcompris/images_selector.c @@ -1,6 +1,6 @@ /* gcompris - images_selector.c * - * Time-stamp: <2005/11/12 19:03:14 bruno> + * Time-stamp: <2006/03/02 00:57:15 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -624,25 +624,26 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) { GError **error = NULL; /* get the filename of this ImageSet */ - imageSetName = xmlGetProp(cur,"filename"); - if (xmlHasProp(cur,"PathName")){ - pathname = xmlGetProp(cur,"PathName"); + imageSetName = (gchar *)xmlGetProp(cur, BAD_CAST "filename"); + if (xmlHasProp(cur, BAD_CAST "PathName")){ + pathname = (gchar *)xmlGetProp(cur, BAD_CAST "PathName"); havePathName = TRUE; } if (havePathName && pathname[0] == '~'){ /* replace '~' by home dir */ pathname = g_strdup_printf("%s%s",g_get_home_dir(), pathname+1); if (!g_file_test ((pathname), G_FILE_TEST_IS_DIR)){ - g_warning("In ImageSet %s, the pathname for the home directory '%s' is not found. Skipping the whole ImageSet.", imageSetName, pathname); + g_warning("In ImageSet %s, the pathname for the home directory '%s' is not found. Skipping the whole ImageSet.", + imageSetName, pathname); return; } } - if (xmlHasProp(cur,"type")){ + if (xmlHasProp(cur, BAD_CAST "type")){ /* lsdir means try all file of directory */ /* list means just keep old behaviour */ /* others are extensions to look for */ - type = xmlGetProp(cur,"type"); + type = (gchar *)xmlGetProp(cur, BAD_CAST "type"); } /* Looking for imageSetName */ @@ -678,7 +679,7 @@ parseImage (xmlDocPtr doc, xmlNodePtr cur) { while (cur != NULL) { if ((!xmlStrcmp(cur->name, (const xmlChar *)"Image"))) { /* get the filename of this ImageSet */ - filename = xmlGetProp(cur,"filename"); + filename = (gchar *)xmlGetProp(cur, BAD_CAST "filename"); if (havePathName){ filename = g_strdup_printf("%s/%s",pathname,filename); } @@ -784,7 +785,7 @@ read_xml_file(gchar *fname) /* if it doesn't have a name */ !doc->children->name || /* if it isn't the good node */ - g_strcasecmp(doc->children->name,"ImageSetRoot")!=0) { + g_strcasecmp((gchar *)doc->children->name, "ImageSetRoot")!=0) { xmlFreeDoc(doc); return FALSE; } @@ -807,7 +808,8 @@ read_dataset_directory(gchar *dataset_dir) GError **error = NULL; GDir *dataset_directory = g_dir_open (dataset_dir, 0, error); - gchar *fname, *absolute_fname; + const gchar *fname; + gchar *absolute_fname; while ((fname = g_dir_read_name(dataset_directory))) { /* skip files without ".xml" */ @@ -838,7 +840,7 @@ read_dataset_directory(gchar *dataset_dir) /* if it doesn't have a name */ !doc->children->name || /* if it isn't the good node */ - g_strcasecmp(doc->children->name,"ImageSetRoot")!=0) { + g_strcasecmp((gchar *)doc->children->name, "ImageSetRoot")!=0) { xmlFreeDoc(doc); continue; } diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c index de318eb..e676b7d 100644 --- a/src/gcompris/properties.c +++ b/src/gcompris/properties.c @@ -1,6 +1,6 @@ /* gcompris - properties.c * - * Time-stamp: <2006/01/21 20:50:15 yves> + * Time-stamp: <2006/03/02 01:08:31 bruno> * * Copyright (C) 2000,2003 Bruno Coudoin * @@ -168,6 +168,8 @@ GcomprisProperties *gcompris_properties_new () tmp->difficulty_max = 0; tmp->filter_style = GCOMPRIS_FILTER_NONE; /* No difficulty filter by default */ tmp->difficulty_filter = 1; /* No difficulty filter by default */ + tmp->disable_quit = 0; /* Used to remove the quit button from the bar. Use it for kiosk mode */ + tmp->disable_config = 0; /* Used to remove the config button from the bar. Use it for kiosk mode */ tmp->root_menu = "/"; tmp->local_directory = NULL; tmp->package_data_dir = PACKAGE_DATA_DIR; @@ -251,6 +253,12 @@ GcomprisProperties *gcompris_properties_new () } else if(!strcmp(value.v_identifier, "difficulty_filter")) { if(!scan_get_int(scanner, &tmp->difficulty_filter)) g_warning("Config file parsing error on token %s", token); + } else if(!strcmp(value.v_identifier, "disable_quit")) { + if(!scan_get_int(scanner, &tmp->disable_quit)) + g_warning("Config file parsing error on token %s", token); + } else if(!strcmp(value.v_identifier, "disable_config")) { + if(!scan_get_int(scanner, &tmp->disable_config)) + g_warning("Config file parsing error on token %s", token); } else if(!strcmp(value.v_identifier, "filter_style")) { if(!scan_get_int(scanner, &tmp->filter_style)) g_warning("Config file parsing error on token %s", token); @@ -343,16 +351,8 @@ void gcompris_properties_save (GcomprisProperties *props) fprintf(filefd, "%s=%d\n", "fx", props->fx); fprintf(filefd, "%s=%d\n", "screensize", props->screensize); fprintf(filefd, "%s=%d\n", "fullscreen", props->fullscreen); - /* FIXME: No more persist the noxrandr option until we provide a way to set it back - * - fprintf(filefd, "%s=%d\n", "noxrandr", props->noxrandr); */ fprintf(filefd, "%s=%d\n", "timer", props->timer); - /* No more need to persist these, it's in the base now - fprintf(filefd, "%s=%d\n", "difficulty_filter", props->difficulty_filter); - fprintf(filefd, "%s=%d\n", "filter_style", props->filter_style); - */ - fprintf(filefd, "%s=\"%s\"\n", "skin", props->skin); fprintf(filefd, "%s=\"%s\"\n", "locale", props->locale); fprintf(filefd, "%s=\"%s\"\n", "key", props->key); diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h index a422b0a..7e282de 100644 --- a/src/gcompris/properties.h +++ b/src/gcompris/properties.h @@ -1,6 +1,6 @@ /* gcompris - properties.h * - * Time-stamp: <2006/01/21 20:49:43 yves> + * Time-stamp: <2006/03/02 00:48:25 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -36,6 +36,8 @@ typedef struct { gint filter_style; gint difficulty_filter; gint difficulty_max; + gint disable_quit; + gint disable_config; gchar *root_menu; gchar *local_directory; gchar *user_data_dir; diff --git a/src/gcompris/skin.c b/src/gcompris/skin.c index 9843822..79b8e22 100644 --- a/src/gcompris/skin.c +++ b/src/gcompris/skin.c @@ -278,7 +278,7 @@ void gcompris_skin_xml_load (gchar* skin) /* if it doesn't have a name */ !xmldoc->children->name || /* if it isn't a GCompris node */ - g_strcasecmp(xmldoc->children->name,"GCompris")!=0) { + g_strcasecmp((gchar *)xmldoc->children->name, "GCompris")!=0) { g_warning("No Gcompris node"); xmlFreeDoc(xmldoc); return; @@ -289,7 +289,7 @@ void gcompris_skin_xml_load (gchar* skin) skinNode = skinNode->next; if((skinNode==NULL)|| - g_strcasecmp(skinNode->name,"Skin")!=0) { + g_strcasecmp((gchar *)skinNode->name, "Skin")!=0) { g_warning("No Skin node %s", xmldoc->children->children->name); xmlFreeDoc(xmldoc); return; @@ -298,7 +298,7 @@ void gcompris_skin_xml_load (gchar* skin) node = skinNode->children; while(node !=NULL) { - if(g_strcasecmp(node->name,"color")==0){ + if(g_strcasecmp((gchar *)node->name, "color")==0){ key = xmlGetProp(node, "id"); data = xmlGetProp(node, "rgba"); if((key!=NULL)&&(data!=NULL)){ @@ -310,7 +310,7 @@ void gcompris_skin_xml_load (gchar* skin) } if(data!=NULL) g_free(data); } - else if(g_strcasecmp(node->name,"font")==0){ + else if(g_strcasecmp((gchar *)node->name, "font")==0){ key = xmlGetProp(node, "id"); data = xmlGetProp(node, "name"); if((key!=NULL)&&(data!=NULL)){ @@ -320,9 +320,9 @@ void gcompris_skin_xml_load (gchar* skin) if(data!=NULL) g_free(data); } } - else if(g_strcasecmp(node->name,"number")==0){ - key = xmlGetProp(node, "id"); - data = xmlGetProp(node, "value"); + else if(g_strcasecmp((gchar *)node->name, "number")==0){ + key = (gchar *)xmlGetProp(node, BAD_CAST "id"); + data = (gchar *)xmlGetProp(node, BAD_CAST "value"); if((key!=NULL)&&(data!=NULL)){ int number = atoi(data); g_hash_table_insert(gcompris_skin_numbers, key, GUINT_TO_POINTER(number)); |