diff options
author | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-08-11 13:17:42 (GMT) |
---|---|---|
committer | Bruno Coudoin <bcoudoin@src.gnome.org> | 2006-08-11 13:17:42 (GMT) |
commit | 7c9d8c5f8483c6c389b31459cc297ed6d2cdb837 (patch) | |
tree | 67652b450e729b9bdc0c8f93b686065c4ee8d549 | |
parent | f36b9357b877bc24da03f367aad0f61ee9eac460 (diff) |
- Fixed potential the exit code to avoid a potential core dump when exiting GCompris
Fixed administration. When leave the boards module, GCompris was quitting. This bug has been
introduced in a fix the 2006-07-10.
Now leaving GCompris in administration mode, there is no more segfaults.
* boards/oscar_and_friends/scene1_0.png: improved by Josef Vybiral
* configure.in: added support for gnet (disabled by default)
* src/boards/python/admin/module_boards.py: fixed management of the module state. no more double stop modules.
* src/boards/python/admin/module_users.py: -
* src/boards/python/administration.py: -
* src/boards/python/oscar_and_friends.py: changed text coordinate and colors
* src/gcompris/Makefile.am: added gc_net.*
* src/gcompris/gc_net.c: empty now, will hold the network code
* src/gcompris/gc_net.h: -
* src/gcompris/board.c: (board_pause), (board_stop),
(get_board_playing):
* src/gcompris/board.h: cleanup, removed pause board state saving. now board_pause takes an argument, no more a toggle.
* src/gcompris/board_config.c: (gcompris_combo_box_changed),
(my_strcmp): added several static. code cleanup.
* src/gcompris/gameutil.c: (gcompris_load_pixmap),
(gcompris_dialog), (item_event_ok): prepared net code.
* src/gcompris/gcompris.c: (gcompris_end_board), (cleanup),
(gcompris_exit), (quit_cb), (gcompris_init): fixed quit sequence. now a real exit is done after gtk_main_quit
* src/gcompris/gcompris.h: added gc_net
* src/gcompris/properties.c: (gcompris_properties_new): added server option
* src/gcompris/properties.h: -
* src/gcompris/sdlplayer.c: (sdlplayer_init), (sdlplayer_quit),
(sdlplayer_bg): replaced printf by g_warning
* src/gcompris/skin.c: (gcompris_image_to_skin): no more return an empty skin but the default one anyway. It will fail later on
anyway if the image is not available.
-rw-r--r-- | ChangeLog | 33 | ||||
-rw-r--r-- | boards/oscar_and_friends/scene1_0.png | bin | 104467 -> 102681 bytes | |||
-rw-r--r-- | configure.in | 16 | ||||
-rw-r--r-- | src/boards/python/admin/module_boards.py | 5 | ||||
-rw-r--r-- | src/boards/python/admin/module_users.py | 2 | ||||
-rw-r--r-- | src/boards/python/administration.py | 16 | ||||
-rw-r--r-- | src/boards/python/oscar_and_friends.py | 7 | ||||
-rw-r--r-- | src/gcompris/Makefile.am | 5 | ||||
-rw-r--r-- | src/gcompris/board.c | 21 | ||||
-rw-r--r-- | src/gcompris/board.h | 4 | ||||
-rw-r--r-- | src/gcompris/board_config.c | 24 | ||||
-rw-r--r-- | src/gcompris/gameutil.c | 47 | ||||
-rw-r--r-- | src/gcompris/gc_net.c | 42 | ||||
-rw-r--r-- | src/gcompris/gc_net.h | 38 | ||||
-rw-r--r-- | src/gcompris/gcompris.c | 38 | ||||
-rw-r--r-- | src/gcompris/gcompris.h | 3 | ||||
-rw-r--r-- | src/gcompris/properties.c | 4 | ||||
-rw-r--r-- | src/gcompris/properties.h | 3 | ||||
-rw-r--r-- | src/gcompris/sdlplayer.c | 8 | ||||
-rw-r--r-- | src/gcompris/skin.c | 18 |
20 files changed, 232 insertions, 102 deletions
@@ -1,5 +1,38 @@ 2006-08-11 Bruno coudoin <bruno.coudoin@free.fr> + - Fixed potential the exit code to avoid a potential core dump when exiting GCompris + Fixed administration. When leave the boards module, GCompris was quitting. This bug has been + introduced in a fix the 2006-07-10. + Now leaving GCompris in administration mode, there is no more segfaults. + + * boards/oscar_and_friends/scene1_0.png: improved by Josef Vybiral + * configure.in: added support for gnet (disabled by default) + * src/boards/python/admin/module_boards.py: fixed management of the module state. no more double stop modules. + * src/boards/python/admin/module_users.py: - + * src/boards/python/administration.py: - + * src/boards/python/oscar_and_friends.py: changed text coordinate and colors + * src/gcompris/Makefile.am: added gc_net.* + * src/gcompris/gc_net.c: empty now, will hold the network code + * src/gcompris/gc_net.h: - + * src/gcompris/board.c: (board_pause), (board_stop), + (get_board_playing): + * src/gcompris/board.h: cleanup, removed pause board state saving. now board_pause takes an argument, no more a toggle. + * src/gcompris/board_config.c: (gcompris_combo_box_changed), + (my_strcmp): added several static. code cleanup. + * src/gcompris/gameutil.c: (gcompris_load_pixmap), + (gcompris_dialog), (item_event_ok): prepared net code. + * src/gcompris/gcompris.c: (gcompris_end_board), (cleanup), + (gcompris_exit), (quit_cb), (gcompris_init): fixed quit sequence. now a real exit is done after gtk_main_quit + * src/gcompris/gcompris.h: added gc_net + * src/gcompris/properties.c: (gcompris_properties_new): added server option + * src/gcompris/properties.h: - + * src/gcompris/sdlplayer.c: (sdlplayer_init), (sdlplayer_quit), + (sdlplayer_bg): replaced printf by g_warning + * src/gcompris/skin.c: (gcompris_image_to_skin): no more return an empty skin but the default one anyway. It will fail later on + anyway if the image is not available. + +2006-08-11 Bruno coudoin <bruno.coudoin@free.fr> + - Added a new activity (uncomplete). It's a story based on the drawings of Josef Vybiral For now the kid can just read the text of the first image in the first scene. diff --git a/boards/oscar_and_friends/scene1_0.png b/boards/oscar_and_friends/scene1_0.png Binary files differindex 6442846..6933ce8 100644 --- a/boards/oscar_and_friends/scene1_0.png +++ b/boards/oscar_and_friends/scene1_0.png diff --git a/configure.in b/configure.in index da0d875..d2aec6d 100644 --- a/configure.in +++ b/configure.in @@ -267,6 +267,20 @@ AC_ARG_ENABLE(sqlite, with_sqlite="$enableval", with_sqlite="yes") AC_MSG_RESULT($with_sqlite) +dnl GNET support +AC_MSG_CHECKING([wether we build with GNET (if not, networking will be disabled)]) +AC_ARG_ENABLE(gnet, + AC_HELP_STRING( + [--disable-gnet], + [Turn on gnet (will let GCompris fetch content from a web server)]), + with_gnet="$enableval", with_gnet="no") +AC_MSG_RESULT($with_gnet) + +if test x$with_gnet = xyes; then + PKG_CHECK_MODULES(GNET, gnet-2.0,, AC_MSG_ERROR([*** GNET not found!])) + AC_DEFINE([USE_GNET], 1,[Networking is enabled]) +fi + dnl check for python AC_ARG_WITH(python,AC_HELP_STRING( [--with-python=path], @@ -501,6 +515,8 @@ echo "XF86VM option (--enable-xf86vidmode) = $found_xf86vidmode" echo "SQLITE database (--enable-sqlite) = $with_sqlite (profiles depend on this)" +echo "GNET Networking (--enable-gnet) = $with_gnet (networking depends on this)" + echo echo gcompris will be installed in ${prefix} echo to compile and install in in another directory diff --git a/src/boards/python/admin/module_boards.py b/src/boards/python/admin/module_boards.py index b0b19f0..ac311f7 100644 --- a/src/boards/python/admin/module_boards.py +++ b/src/boards/python/admin/module_boards.py @@ -83,5 +83,6 @@ class Boards(module.Module): # Remove the root item removes all the others inside it self.rootitem.destroy() - # For now, quitting admin is definitive - sys.exit() + # Close the database + self.cur.close() + self.con.close() diff --git a/src/boards/python/admin/module_users.py b/src/boards/python/admin/module_users.py index bee921d..cc777e3 100644 --- a/src/boards/python/admin/module_users.py +++ b/src/boards/python/admin/module_users.py @@ -83,7 +83,7 @@ class Users(module.Module): def stop(self): - print "stopping profiles panel" + print "stopping users panel" module.Module.stop(self) # Remove the root item removes all the others inside it diff --git a/src/boards/python/administration.py b/src/boards/python/administration.py index 3ab313c..e9cc031 100644 --- a/src/boards/python/administration.py +++ b/src/boards/python/administration.py @@ -29,7 +29,7 @@ from gettext import gettext as _ # To add a panel, add a python module in the admin subdir # This module must have a start() and end() function class Gcompris_administration: - """Administrating GCompris""" + """Administering GCompris""" def __init__(self, gcomprisBoard): @@ -37,6 +37,7 @@ class Gcompris_administration: # The panel being displayed self.current_panel = None + self.current_panel_stopped = False # Create our rootitem. We put each canvas item in it so at the end we # only have to kill it. The canvas deletes all the items it contains automaticaly. @@ -57,14 +58,15 @@ class Gcompris_administration: def pause(self, pause): - if(self.current_panel != None): if pause: # Stop current panel self.current_panel.stop() + self.current_panel_stopped = True else: # Restart the current panel self.current_panel.start(self.panel_area) + self.current_panel_stopped = False def start(self): @@ -141,8 +143,11 @@ class Gcompris_administration: def end(self): - pass - + # Stop current panel + if(self.current_panel != None and not self.current_panel_stopped): + self.current_panel.stop() + self.current_panel_stopped = False + def ok(self): pass @@ -173,7 +178,8 @@ class Gcompris_administration: # Stop previous panel if any if(self.current_panel != None): self.current_panel.stop() - + self.current_panel_stopped = False + self.current_panel = module # Start the new panel diff --git a/src/boards/python/oscar_and_friends.py b/src/boards/python/oscar_and_friends.py index c9a6ff9..31d11f5 100644 --- a/src/boards/python/oscar_and_friends.py +++ b/src/boards/python/oscar_and_friends.py @@ -99,11 +99,11 @@ class Gcompris_oscar_and_friends: self.text_item = self.rootitem.add( gnome.canvas.CanvasText, - x=400.0, + x=gcompris.BOARD_WIDTH * 0.45, y=gcompris.BOARD_HEIGHT - 40.0, text="", font=gcompris.skin.get_font("gcompris/content"), - fill_color="black", + fill_color="white", justification=gtk.JUSTIFY_CENTER ) self.text_item.hide() @@ -163,10 +163,7 @@ class Gcompris_oscar_and_friends: def next_item_event(self, widget, event=None): if event.type == gtk.gdk.BUTTON_PRESS: if event.button == 1: - print self.current_texts_index self.display_next_text() - print self.current_texts_index - print "---" return True return False diff --git a/src/gcompris/Makefile.am b/src/gcompris/Makefile.am index 3a15f7a..f0dae06 100644 --- a/src/gcompris/Makefile.am +++ b/src/gcompris/Makefile.am @@ -53,6 +53,7 @@ INCLUDES = \ $(SDL_CFLAGS) \ -DGNOME_DISABLE_DEPRECATED \ $(sqlite_cflags) \ + $(GNET_CFLAGS) \ $(cairo_cflags) gcompris_SOURCES = \ @@ -76,7 +77,7 @@ gcompris_LDADD = \ lib_LTLIBRARIES = libgcompris-1.la libgcompris_1_la_LIBADD = \ - $(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) + $(GCOMPRIS_LIBS) $(sqlite_ldadd) $(XML_LIBS) $(GNET_LIBS) libgcompris_1_la_LDFLAGS = $(no_undefined) \ -version-info $(LIBGCOMPRIS_CURRENT):$(LIBGCOMPRIS_REVISION):$(LIBGCOMPRIS_AGE) @@ -89,6 +90,7 @@ libgcomprisinclude_HEADERS = \ bonus.h \ cursor.h \ gameutil.h \ + gc_net.h \ gcompris.h \ gcompris-board.h \ board_config.h \ @@ -112,6 +114,7 @@ libgcompris_1_la_SOURCES = \ $(libgcomprisinclude_HEADERS) \ gcompris.c \ gameutil.c \ + gc_net.c \ properties.c \ bar.c \ file_selector.c \ diff --git a/src/gcompris/board.c b/src/gcompris/board.c index 8ffe75a..977248c 100644 --- a/src/gcompris/board.c +++ b/src/gcompris/board.c @@ -365,34 +365,24 @@ void board_play(GcomprisBoard *gcomprisBoard) bp_data->playing = TRUE; } -void board_pause(void) +void board_pause(int pause) { if (get_board_playing() && get_current_board_plugin()) { - bp_data->paused = !bp_data->paused; - get_current_board_plugin()->pause_board(bp_data->paused); + if(get_current_board_plugin()->pause_board) + get_current_board_plugin()->pause_board(pause); } } void board_stop(void) { - - /* If we are in the upper menu, no need to stop and restart it */ - if (get_current_gcompris_board()->previous_board == NULL){ - return; - } - if (bp_data->playing && get_current_board_plugin()) { bp_data->playing = FALSE; - if (bp_data->paused) - board_pause(); if (get_current_board_plugin()->end_board) get_current_board_plugin()->end_board(); - bp_data->paused = FALSE; - gcompris_end_board(); return; @@ -405,11 +395,6 @@ gboolean get_board_playing(void) return bp_data->playing; } -gboolean get_board_paused(void) -{ - return bp_data->paused; -} - static GcomprisBoard *next_board = NULL; static gint next_board_callback_id = 0; #define NEXT_TIME_DELAY 10 diff --git a/src/gcompris/board.h b/src/gcompris/board.h index 9acc1e6..d3a6c26 100644 --- a/src/gcompris/board.h +++ b/src/gcompris/board.h @@ -46,7 +46,6 @@ struct BoardPluginData { GcomprisBoard *current_gcompris_board; gboolean playing; - gboolean paused; }; void init_plugins(void); @@ -57,9 +56,8 @@ void set_current_gcompris_board(GcomprisBoard * gcomprisBoard); gboolean board_check_file(GcomprisBoard *gcomprisBoard); void board_play(GcomprisBoard *gcomprisBoard); void board_stop(void); -void board_pause(void); +void board_pause(int pause); gboolean get_board_playing(void); -gboolean get_board_paused(void); gchar *board_get_info_text(void); void board_set_info_text(gchar * text); diff --git a/src/gcompris/board_config.c b/src/gcompris/board_config.c index a9abfdc..b33538e 100644 --- a/src/gcompris/board_config.c +++ b/src/gcompris/board_config.c @@ -1,6 +1,6 @@ /* gcompris - board_config.c * - * Time-stamp: <2006/05/10 23:11:49 bruno> + * Time-stamp: <2006/08/11 14:22:34 bruno> * * Copyright (C) 2001 Pascal Georges * @@ -288,8 +288,8 @@ gcompris_get_active_text (GtkComboBox *combo_box) return text; } -void gcompris_combo_box_changed(GtkComboBox *combobox, - gpointer key) +static void gcompris_combo_box_changed(GtkComboBox *combobox, + gpointer key) { gchar *the_key = g_strdup((gchar *)key); @@ -298,7 +298,7 @@ void gcompris_combo_box_changed(GtkComboBox *combobox, g_hash_table_replace(hash_conf, (gpointer) the_key, (gpointer) value); } -inline int my_strcmp(gchar *a, gchar *b) { return strcmp( a, b); } +static inline int my_strcmp(gchar *a, gchar *b) { return strcmp( a, b); } GtkComboBox *gcompris_combo_box(const gchar *label, GList *strings, gchar *key, gchar *init) @@ -377,8 +377,8 @@ static gchar *radio_key = NULL; static gchar *radio_text = NULL; static gchar *radio_init = NULL; -void radio_changed(GtkToggleButton *togglebutton, - gpointer key) +static void radio_changed(GtkToggleButton *togglebutton, + gpointer key) { gboolean state = gtk_toggle_button_get_active (togglebutton); gchar *h_key; @@ -391,9 +391,9 @@ void radio_changed(GtkToggleButton *togglebutton, } } -void create_radio_buttons(gpointer key, - gpointer value, - gpointer hash_radio) +static void create_radio_buttons(gpointer key, + gpointer value, + gpointer hash_radio) { GtkWidget *radio_button; gchar *key_copy; @@ -420,7 +420,7 @@ void create_radio_buttons(gpointer key, g_hash_table_replace ( hash_radio, (gpointer) key_copy, (gpointer) radio_button); } -void destroy_hash (GtkObject *object, +static void destroy_hash (GtkObject *object, gpointer hash_table) { g_hash_table_destroy((GHashTable *)hash_table); @@ -481,8 +481,8 @@ GHashTable *gcompris_radio_buttons(const gchar *label, return buttons; } -void spin_changed (GtkSpinButton *spinbutton, - gpointer key) +static void spin_changed (GtkSpinButton *spinbutton, + gpointer key) { gchar *h_key = g_strdup((gchar *) key); gchar *h_value = g_strdup_printf("%d",gtk_spin_button_get_value_as_int (spinbutton)); diff --git a/src/gcompris/gameutil.c b/src/gcompris/gameutil.c index c296ef0..28af3bd 100644 --- a/src/gcompris/gameutil.c +++ b/src/gcompris/gameutil.c @@ -1,8 +1,8 @@ /* gcompris - gameutil.c * - * Time-stamp: <2006/07/10 01:24:04 bruno> + * Time-stamp: <2006/08/11 14:11:24 bruno> * - * Copyright (C) 2000 Bruno Coudoin + * Copyright (C) 2000-2006 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 @@ -61,24 +61,31 @@ GdkPixbuf *gcompris_load_pixmap(char *pixmapfile) GdkPixbuf *pixmap=NULL; /* Search */ - filename = gcompris_find_absolute_filename(pixmapfile); - if (!filename) { - char *str; - g_warning ("Couldn't find file %s !", pixmapfile); - - str = g_strdup_printf("%s\n%s\n%s\n%s", - _("Couldn't find file"), - pixmapfile, - _("This activity is incomplete."), - _("Exit it and report\nthe problem to the authors.")); - gcompris_dialog (str, NULL); - g_free(str); - return NULL; - } + if (!filename) + { + pixmap = gc_net_load_pixmap(pixmapfile); - pixmap = gdk_pixbuf_new_from_file (filename, NULL); + if(!pixmap) + { + char *str; + g_warning ("Couldn't find file %s !", pixmapfile); + + str = g_strdup_printf("%s\n%s\n%s\n%s", + _("Couldn't find file"), + pixmapfile, + _("This activity is incomplete."), + _("Exit it and report\nthe problem to the authors.")); + gcompris_dialog (str, NULL); + g_free(str); + return NULL; + } + } + else + { + pixmap = gdk_pixbuf_new_from_file (filename, NULL); + } g_free(filename); @@ -1043,8 +1050,7 @@ void gcompris_dialog(gchar *str, DialogBoxCallBack dbcb) } /* First pause the board */ - if(gcomprisBoard->plugin && gcomprisBoard->plugin->pause_board != NULL) - gcomprisBoard->plugin->pause_board(TRUE); + board_pause(TRUE); gcompris_bar_hide(TRUE); @@ -1136,8 +1142,7 @@ item_event_ok(GnomeCanvasItem *item, GdkEvent *event, DialogBoxCallBack dbcb) gcompris_dialog_close(); /* restart the board */ - if(gcomprisBoard->plugin->pause_board != NULL) - gcomprisBoard->plugin->pause_board(FALSE); + board_pause(FALSE); gcompris_bar_hide(FALSE); diff --git a/src/gcompris/gc_net.c b/src/gcompris/gc_net.c new file mode 100644 index 0000000..ce01743 --- /dev/null +++ b/src/gcompris/gc_net.c @@ -0,0 +1,42 @@ +/* gcompris - gc_net.c + * + * Time-stamp: <2006/07/10 01:24:04 bruno> + * + * Copyright (C) 2006 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "gc_net.h" + +#ifdef USE_GNET +#include <gnet.h> +#endif + +/* + * Init the network library, must be called once before using it + */ +void gc_net_init() +{ +} + +/* + * load a pixmap from the network + * pixmapfile is given relative to PACKAGE_DATA_DIR + */ +GdkPixbuf *gc_net_load_pixmap(char *pixmapfile) +{ + return NULL; +} diff --git a/src/gcompris/gc_net.h b/src/gcompris/gc_net.h new file mode 100644 index 0000000..0b80f9a --- /dev/null +++ b/src/gcompris/gc_net.h @@ -0,0 +1,38 @@ +/* gcompris - gc_net.h + * + * Time-stamp: <2000/07/16 00:32:26 bruno> + * + * Copyright (C) 2006 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 + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +/*! \file net.h + \brief Function related to networking +*/ + +#ifndef GC_NET_H +#define GC_NET_H + +#include <gdk-pixbuf/gdk-pixbuf.h> + +#include "gcompris.h" + +#define GCOMPRIS_BASE_URL "http://gcompris.net/gcompris" + +void gc_net_init(); +GdkPixbuf *gc_net_load_pixmap(char *pixmapfile); + +#endif diff --git a/src/gcompris/gcompris.c b/src/gcompris/gcompris.c index af0d240..3c6273d 100644 --- a/src/gcompris/gcompris.c +++ b/src/gcompris/gcompris.c @@ -120,6 +120,7 @@ static int popt_experimental = FALSE; static int popt_no_quit = FALSE; static int popt_no_config = FALSE; static int popt_display_resource = FALSE; +static char *popt_server = NULL; static struct poptOption options[] = { {"fullscreen", 'f', POPT_ARG_NONE, &popt_fullscreen, 0, @@ -172,6 +173,8 @@ static struct poptOption options[] = { N_("Disable the config button"), NULL}, {"display-resource",'\0', POPT_ARG_NONE, &popt_display_resource, 0, N_("Display the resources on stdout based on the selected activities"), NULL}, + {"server", '\0', POPT_ARG_STRING, &popt_server, 0, + N_("GCompris will get images, sounds and activity data from this server if not found locally. To use the default server, set this value to 'gcompris.net'"), NULL}, #ifndef WIN32 /* Not supported on windows */ POPT_AUTOHELP #endif @@ -810,13 +813,10 @@ static void setup_window () void gcompris_end_board() { - if (get_current_gcompris_board()->previous_board == NULL) - /* We are in the upper menu */ - /* board_play (properties->menu_board); */ - gcompris_exit(); - else + if (get_current_gcompris_board()->previous_board) { /* Run the previous board */ board_play (get_current_gcompris_board()->previous_board); + } } /** \brief toggle full screen mode @@ -886,21 +886,20 @@ void gcompris_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) #endif } -void gcompris_exit() +static void cleanup() { /* Do not loopback in exit */ signal(SIGINT, NULL); signal(SIGSEGV, NULL); board_stop(); - gcompris_db_exit(); - gcompris_set_fullscreen(FALSE); +} - gtk_main_quit (); - - +void gcompris_exit() +{ + g_signal_emit_by_name(G_OBJECT(window), "delete_event"); } static void quit_cb (GtkWidget *widget, gpointer data) @@ -909,8 +908,14 @@ static void quit_cb (GtkWidget *widget, gpointer data) #ifdef DMALLOC dmalloc_shutdown(); #endif - gcompris_exit(); + cleanup(); + gtk_main_quit(); + /* + * Very important or GCompris crashes on exit when closed from the dialog + * It's like if code in the dialog callback continue after the gtk_main_quit is done + */ + exit(0); } /* @@ -1451,6 +1456,12 @@ gcompris_init (int argc, char *argv[]) properties->reread_menu = TRUE; } + if (popt_server){ + if (strcmp(popt_server,"gcompris.net")==0) + properties->server = g_strdup(GCOMPRIS_BASE_URL); + else + properties->server = g_strdup(popt_server); + } /* * Database init MUST BE after properties @@ -1527,6 +1538,9 @@ gcompris_init (int argc, char *argv[]) /* Gdk-Pixbuf */ gdk_rgb_init(); + /* networking init */ + gc_net_init(); + setup_window (); gtk_widget_show_all (window); diff --git a/src/gcompris/gcompris.h b/src/gcompris/gcompris.h index 871d52f..e47da52 100644 --- a/src/gcompris/gcompris.h +++ b/src/gcompris/gcompris.h @@ -1,6 +1,6 @@ /* gcompris - gcompris.h * - * Time-stamp: <2006/05/10 01:03:16 bruno> + * Time-stamp: <2006/08/11 14:09:45 bruno> * * Copyright (C) 2000,2001,2002 Bruno Coudoin * @@ -42,6 +42,7 @@ #include "board_config.h" #include "properties.h" #include "gameutil.h" +#include "gc_net.h" #include "bonus.h" #include "timer.h" #include "score.h" diff --git a/src/gcompris/properties.c b/src/gcompris/properties.c index 3b0787f..321f58c 100644 --- a/src/gcompris/properties.c +++ b/src/gcompris/properties.c @@ -1,6 +1,6 @@ /* gcompris - properties.c * - * Time-stamp: <2006/06/26 22:25:53 bruno> + * Time-stamp: <2006/08/10 14:16:19 bruno> * * Copyright (C) 2000,2003 Bruno Coudoin * @@ -182,6 +182,8 @@ GcomprisProperties *gcompris_properties_new () tmp->experimental = FALSE; tmp->menu_position = NULL; + tmp->server = NULL; + gcompris_user_dir = get_gcompris_user_root_directory() ; create_rootdir( gcompris_user_dir ); diff --git a/src/gcompris/properties.h b/src/gcompris/properties.h index 4549633..06e93fa 100644 --- a/src/gcompris/properties.h +++ b/src/gcompris/properties.h @@ -1,6 +1,6 @@ /* gcompris - properties.h * - * Time-stamp: <2006/06/26 22:25:02 bruno> + * Time-stamp: <2006/08/10 14:15:38 bruno> * * Copyright (C) 2000 Bruno Coudoin * @@ -58,6 +58,7 @@ typedef struct { gchar *default_context; gint experimental; gchar *menu_position; + gchar *server; } GcomprisProperties; GcomprisProperties *gcompris_get_properties (void); diff --git a/src/gcompris/sdlplayer.c b/src/gcompris/sdlplayer.c index 82815aa..f17b56d 100644 --- a/src/gcompris/sdlplayer.c +++ b/src/gcompris/sdlplayer.c @@ -87,8 +87,8 @@ int sdlplayer_init() // print out some info on the audio device and stream Mix_QuerySpec(&audio_rate, &audio_format, &audio_channels); bits=audio_format&0xFF; - printf("Opened audio at %d Hz %d bit %s, %d bytes audio buffer\n", audio_rate, - bits, audio_channels>1?"stereo":"mono", audio_buffers ); + g_warning("Opened audio at %d Hz %d bit %s, %d bytes audio buffer\n", audio_rate, + bits, audio_channels>1?"stereo":"mono", audio_buffers ); sound_paused = FALSE; return(0); @@ -99,7 +99,7 @@ int sdlplayer_quit(Mix_Music *music) // free & close Mix_FreeMusic(music); Mix_CloseAudio(); - printf("SDL PLAYER SDL_Quit\n"); + g_warning("SDL PLAYER SDL_Quit\n"); SDL_Quit(); return 0; @@ -112,7 +112,7 @@ int sdlplayer_bg(char *filename, int volume) while (sound_paused) SDL_Delay(50); - printf("sdlplayer_bg %s\n", filename); + g_warning("sdlplayer_bg %s\n", filename); // load the song if(!(music=Mix_LoadMUS(filename))) diff --git a/src/gcompris/skin.c b/src/gcompris/skin.c index b076d8a..a1856aa 100644 --- a/src/gcompris/skin.c +++ b/src/gcompris/skin.c @@ -72,21 +72,9 @@ gchar *gcompris_image_to_skin(gchar *pixmapfile) return(filename); } - /* Now check if pixmapfile is in the default skin dir */ - - filename = g_strdup_printf("%s/skins/%s/%s", PACKAGE_DATA_DIR, DEFAULT_SKIN, pixmapfile); - - if (g_file_test ((filename), G_FILE_TEST_EXISTS)) { - g_free(filename); - - filename = g_strdup_printf("skins/%s/%s", DEFAULT_SKIN, pixmapfile); - - return(filename); - } - - g_warning ("Couldn't find file %s !", filename); - - return(NULL); + /* Return the default skin dir */ + filename = g_strdup_printf("skins/%s/%s", DEFAULT_SKIN, pixmapfile); + return(filename); } /* |