Commit d6cf7d18 authored by Bruno Coudoin's avatar Bruno Coudoin

- Fixed default path search for platform not supported by binreloc

	- removed x86-64 warning (all remaining ones I hope).
	- Added "weight", PANGO_WEIGHT_HEAVY, in all dialogs for the title and
	  ok button. It looks better.
	- Fixed menu2 to lock the user board selection until the display is complete.
	- Added support in gc_net_load_pixmap to also load local file. Thus I standartize
	  on called this one which will make local or remote load depending on the url given.
parent d463d12d
2006-08-15 Bruno coudoin <bruno.coudoin@free.fr>
- Fixed default path search for platform not supported by binreloc
- removed x86-64 warning (all remaining ones I hope).
- Added "weight", PANGO_WEIGHT_HEAVY, in all dialogs for the title and
ok button. It looks better.
- Fixed menu2 to lock the user board selection until the display is complete.
- Added support in gc_net_load_pixmap to also load local file. Thus I standartize
on called this one which will make local or remote load depending on the url given.
* src/boards/click_on_letter.c: (click_on_letter_create_item):
* src/boards/gtans_callbacks.c: (on_rotation_clicked):
* src/boards/menu2.c: (display_section), (item_event),
(display_welcome):
* src/boards/money_widget.c: (money_display_total):
* src/boards/smallnumbers.c: (key_press):
* src/boards/target.c: (key_press), (display_windspeed),
(target_create_item), (request_score):
* src/gcompris/about.c: (gcompris_about_start):
* src/gcompris/bar.c: (item_event_bar):
* src/gcompris/config.c: (gcompris_config_start),
(set_locale_flag), (item_event_ok):
* src/gcompris/gameutil.c: (gcompris_load_pixmap),
(gcompris_dialog), (gcompris_find_absolute_filename):
* src/gcompris/gc_net.c: (my_strcmp), (gc_net_init),
(gc_net_load_pixmap), (gc_net_get_url_from_file), (gc_net_is_url):
* src/gcompris/gc_net.h:
* src/gcompris/gcompris.c: (setup_window), (load_properties),
(gcompris_init):
* src/gcompris/help.c: (gcompris_help_start):
* src/gcompris/skin.c: (gcompris_image_to_skin):
* src/gcompris/timer.c: (gcompris_timer_display),
(timer_increment):
2006-08-14 Bruno coudoin <bruno.coudoin@free.fr>
- Fixed compilation warnings and potential bugs for x86-64.
......
......@@ -412,7 +412,6 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent)
for (i=0; i< number_of_letters; i++) {
buttons[i] = gnome_canvas_item_new (boardRootItem,
gnome_canvas_pixbuf_get_type (),
"pixbuf", button_pixmap,
......@@ -423,13 +422,14 @@ static GnomeCanvasItem *click_on_letter_create_item(GnomeCanvasGroup *parent)
l_items[i] = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", g_strdup(letters[i]),
"text", letters[i],
"font", gcompris_skin_font_board_huge_bold,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", 0x0000ffff,
"x", (double) xOffset + gdk_pixbuf_get_width(button_pixmap)/2,
"y", (double) yOffset + gdk_pixbuf_get_height(button_pixmap)/2 - 5,
NULL);
g_free(letters[i]);
xOffset +=HORIZONTAL_SEPARATION +gdk_pixbuf_get_width(button_pixmap);
......
......@@ -353,7 +353,7 @@ on_rotation_clicked (GnomeCanvasItem *canvasitem,
gint angle = 0;
if (selectedgrande==TRUE){
switch ((gint) user_data){
switch (GPOINTER_TO_INT(user_data)){
case 0:
angle = -rotstepnbr;
break;
......
/* gcompris - menu2.c
*
* Time-stamp: <2006/08/12 02:59:38 bruno>
* Time-stamp: <2006/08/15 02:27:54 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -47,6 +47,9 @@ static MenuItems *menuitems;
static GcomprisBoard *gcomprisBoard = NULL;
static gboolean board_paused = TRUE;
/* We don't wan't the callback on boards to be accepted until the menu is fully displayed */
static gboolean menu_displayed = FALSE;
static void menu_start (GcomprisBoard *agcomprisBoard);
static void menu_pause (gboolean pause);
static void menu_end (void);
......@@ -341,6 +344,8 @@ static void display_section (gchar *path)
{
GList *boardlist; /* List of Board */
menu_displayed = FALSE;
boardlist = gcompris_get_menulist(path);
if (actualSectionItem)
......@@ -366,6 +371,7 @@ static void display_section (gchar *path)
if (strcmp(path,"home")!=0)
g_list_free(boardlist);
menu_displayed = TRUE;
}
static void
......@@ -642,6 +648,9 @@ item_event(GnomeCanvasItem *item, GdkEvent *event, MenuItems *menuitems)
break;
case GDK_BUTTON_PRESS:
if(!menu_displayed)
return TRUE;
gcompris_play_ogg ("sounds/gobble.ogg", NULL);
if (strcmp(board->type,"menu")==0){
......@@ -953,7 +962,8 @@ static void create_top(GnomeCanvasGroup *parent, gchar *path)
}
static void display_welcome (void)
static void
display_welcome (void)
{
GnomeCanvasItem *logo;
GdkPixbuf *pixmap;
......@@ -1009,6 +1019,7 @@ static void display_welcome (void)
"text", "",
NULL);
menu_displayed = TRUE;
}
static void
......
......@@ -223,12 +223,15 @@ money_widget_set_position (Money_Widget *moneyWidget,
static void money_display_total(Money_Widget *moneyWidget)
{
gchar *tmpstr;
g_return_if_fail (moneyWidget != NULL);
tmpstr = g_strdup_printf("%.2f €", moneyWidget->priv->total);
if(moneyWidget->priv->display_total)
gnome_canvas_item_set (moneyWidget->priv->item_total,
"text", g_strdup_printf("%.2f €", moneyWidget->priv->total),
"text", tmpstr,
NULL);
g_free(tmpstr);
}
......
/* gcompris - smallnumbers.c
*
* Time-stamp: <2006/08/12 03:05:21 bruno>
* Time-stamp: <2006/08/15 11:09:04 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -244,7 +244,8 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str)
keyval = atoi(str);
g_list_foreach(GNOME_CANVAS_GROUP(boardRootItem)->item_list,
(GFunc) smallnumbers_gotkey_item, (void *)keyval);
(GFunc) smallnumbers_gotkey_item,
GINT_TO_POINTER(keyval));
return TRUE;
}
......
......@@ -281,9 +281,13 @@ static gint key_press(guint keyval, gchar *commit_str, gchar *preedit_str)
}
if(answer_item)
{
gchar *tmpstr = g_strdup_printf(_("Points = %s"), answer_string);
gnome_canvas_item_set(answer_item,
"text", g_strdup_printf(_("Points = %s"), answer_string),
"text", tmpstr,
NULL);
g_free(tmpstr);
}
return TRUE;
}
......@@ -347,7 +351,7 @@ static void display_windspeed()
{
guint second = 0;
guint needle_zoom = 15;
gchar *tmpstr;
GnomeCanvasPoints *canvasPoints;
canvasPoints = gnome_canvas_points_new (2);
......@@ -400,15 +404,17 @@ static void display_windspeed()
"width_units", (double)1,
NULL);
tmpstr = g_strdup_printf(_("Wind speed = %d\nkilometers/hour"), (guint)wind_speed);
gnome_canvas_item_new (speedRootItem,
gnome_canvas_text_get_type (),
"text", g_strdup_printf(_("Wind speed = %d\nkilometers/hour"), (guint)wind_speed),
"text", tmpstr,
"font", gcompris_skin_font_board_medium,
"x", (double) SPEED_CENTER_X,
"y", (double) SPEED_CENTER_Y + 110,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
NULL);
g_free(tmpstr);
}
......@@ -418,6 +424,7 @@ static void display_windspeed()
static GnomeCanvasItem *target_create_item(GnomeCanvasGroup *parent)
{
int i;
gchar *tmpstr;
GnomeCanvasItem *item = NULL;
boardRootItem = GNOME_CANVAS_GROUP(
......@@ -445,16 +452,18 @@ static GnomeCanvasItem *target_create_item(GnomeCanvasGroup *parent)
gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, NULL);
/* Display the value for this target */
tmpstr = g_strdup_printf("%d",
targetDefinition[gcomprisBoard->level-1].target_width_value[i*2+1]);
item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", g_strdup_printf("%d",
targetDefinition[gcomprisBoard->level-1].target_width_value[i*2+1]),
"text", tmpstr,
"font", gcompris_skin_font_board_medium,
"x", (double) 0,
"y", (double) targetDefinition[gcomprisBoard->level-1].target_width_value[i*2] - 10,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
NULL);
g_free(tmpstr);
gtk_signal_connect(GTK_OBJECT(item), "event", (GtkSignalFunc) item_event, NULL);
}
......@@ -462,16 +471,18 @@ static GnomeCanvasItem *target_create_item(GnomeCanvasGroup *parent)
number_of_arrow = targetDefinition[gcomprisBoard->level-1].number_of_arrow;
tmpstr = g_strdup_printf(_("Distance to target = %d meters"),
targetDefinition[gcomprisBoard->level-1].target_distance);
gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", g_strdup_printf(_("Distance to target = %d meters"),
targetDefinition[gcomprisBoard->level-1].target_distance),
"text", tmpstr,
"font", gcompris_skin_font_board_medium,
"x", (double) 0,
"y", (double) BOARDHEIGHT-TARGET_CENTER_Y -45,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
NULL);
g_free(tmpstr);
display_windspeed();
......@@ -525,6 +536,7 @@ static void request_score()
GdkPixbuf *button_pixmap = NULL;
double y_offset = 160;
double x_offset = 245;
gchar *tmpstr;
gcompris_bar_set(GCOMPRIS_BAR_LEVEL|GCOMPRIS_BAR_OK);
button_pixmap = gcompris_load_skin_pixmap("button_large2.png");
......@@ -535,15 +547,17 @@ static void request_score()
"y", y_offset,
NULL);
tmpstr = g_strdup_printf(_("Points = %s"), "");
answer_item = gnome_canvas_item_new (boardRootItem,
gnome_canvas_text_get_type (),
"text", g_strdup_printf(_("Points = %s"), ""),
"text", tmpstr,
"font", gcompris_skin_font_board_title_bold,
"x", (double) x_offset + gdk_pixbuf_get_width(button_pixmap)/2,
"y", (double) y_offset + gdk_pixbuf_get_height(button_pixmap)/2,
"anchor", GTK_ANCHOR_CENTER,
"fill_color", "white",
NULL);
g_free(tmpstr);
gdk_pixbuf_unref(button_pixmap);
}
......
/* gcompris - about.c
*
* Time-stamp: <2006/08/11 17:21:46 bruno>
* Time-stamp: <2006/08/15 03:56:58 bruno>
*
* Copyright (C) 2000 Bruno Coudoin
*
......@@ -107,6 +107,7 @@ void gcompris_about_start ()
"y", (double) y_start + 40 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
......@@ -116,6 +117,7 @@ void gcompris_about_start ()
"y", (double) y_start + 40,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_title,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
......@@ -343,6 +345,7 @@ void gcompris_about_start ()
"y", (double) y - gdk_pixbuf_get_height(pixmap) + 20 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
......@@ -352,6 +355,7 @@ void gcompris_about_start ()
"y", (double) y - gdk_pixbuf_get_height(pixmap) + 20,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_text_button,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gtk_signal_connect(GTK_OBJECT(item2), "event",
(GtkSignalFunc) item_event_ok,
......
/* gcompris - bar.c
*
* Time-stamp: <2006/05/05 00:48:26 bruno>
* Time-stamp: <2006/08/15 02:39:55 bruno>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
......@@ -534,6 +534,7 @@ item_event_bar(GnomeCanvasItem *item, GdkEvent *event, gchar *data)
else if(!strcmp((char *)data, "back"))
{
gcompris_play_ogg ("gobble", NULL);
gcompris_bar_hide (TRUE);
board_stop();
}
else if(!strcmp((char *)data, "help"))
......
/* gcompris - config.c
*
* Time-stamp: <2006/08/13 17:20:28 bruno>
* Time-stamp: <2006/08/15 03:53:37 bruno>
*
* Copyright (C) 2000-2003 Bruno Coudoin
*
......@@ -190,6 +190,7 @@ void gcompris_config_start ()
"y", (double) y_start + 40 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
......@@ -199,6 +200,7 @@ void gcompris_config_start ()
"y", (double) y_start + 40,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_title,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
pixmap_checked = gcompris_load_skin_pixmap("button_checked.png");
......@@ -368,13 +370,14 @@ void gcompris_config_start ()
guint i;
GDir *dir;
gchar *skin_dir;
gchar *first_skin_name;
/* Load the Pixpmaps directory file names */
skin_dir = g_strconcat(properties->package_data_dir, "/skins", NULL);
dir = g_dir_open(skin_dir, 0, NULL);
if (!dir)
g_error (_("Couldn't open skin dir: %s"), skin_dir);
g_warning (_("Couldn't open skin dir: %s"), skin_dir);
/* Fill up the skin list */
while((one_dirent = g_dir_read_name(dir)) != NULL) {
......@@ -393,11 +396,6 @@ void gcompris_config_start ()
}
g_dir_close(dir);
/* Should not happen. It the user found the config, there should be a skin */
if(g_list_length(skinlist) == 0) {
g_warning( "No skin found in %s\n", skin_dir);
}
g_free(skin_dir);
/* Find the current skin index */
......@@ -408,18 +406,25 @@ void gcompris_config_start ()
y_start += Y_GAP;
/* Should not happen. It the user found the config, there should be a skin */
if(g_list_length(skinlist) > 0) {
g_warning("No skin found in %s\n", skin_dir);
display_previous_next(x_start, y_start, "skin_previous", "skin_next");
first_skin_name = g_strdup_printf(_("Skin : %s"), (char *)g_list_nth_data(skinlist, skin_index));
} else {
first_skin_name = g_strdup(_("SKINS NOT FOUND"));
}
item_skin_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
"text", g_strdup_printf(_("Skin : %s"),
(char *)g_list_nth_data(skinlist, skin_index)),
"text", first_skin_name,
"font", gcompris_skin_font_subtitle,
"x", (double) x_text_start,
"y", (double) y_start,
"anchor", GTK_ANCHOR_WEST,
"fill_color_rgba", gcompris_skin_color_content,
NULL);
g_free(first_skin_name);
}
// Difficulty Filter
......@@ -465,6 +470,7 @@ void gcompris_config_start ()
"y", (double) y - gdk_pixbuf_get_height(pixmap) + 20 + 1.0,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_shadow,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
gnome_canvas_text_get_type (),
......@@ -474,6 +480,7 @@ void gcompris_config_start ()
"y", (double) y - gdk_pixbuf_get_height(pixmap) + 20,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_text_button,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gtk_signal_connect(GTK_OBJECT(item2), "event",
(GtkSignalFunc) item_event_ok,
......@@ -586,7 +593,7 @@ static void set_locale_flag(gchar *locale)
if(filename)
{
pixmap = gdk_pixbuf_new_from_file (filename, NULL);
pixmap = gc_net_load_pixmap(filename);
gnome_canvas_item_set (item_locale_flag,
"pixbuf", pixmap,
......@@ -824,24 +831,30 @@ item_event_ok(GnomeCanvasItem *item, GdkEvent *event, gpointer data)
}
else if(!strcmp((char *)data, "skin_previous"))
{
gchar *skin_str;
if(skin_index-- < 1)
skin_index = g_list_length(skinlist)-1;
skin_str = g_strdup_printf(_("Skin : %s"),
(char *)g_list_nth_data(skinlist, skin_index));
gnome_canvas_item_set (item_skin_text,
"text", g_strdup_printf(_("Skin : %s"),
(char *)g_list_nth_data(skinlist, skin_index)),
"text", skin_str,
NULL);
g_free(skin_str);
}
else if(!strcmp((char *)data, "skin_next"))
{
gchar *skin_str;
if(skin_index++ >= g_list_length(skinlist)-1)
skin_index = 0;
skin_str = g_strdup_printf(_("Skin : %s"),
(char *)g_list_nth_data(skinlist, skin_index));
gnome_canvas_item_set (item_skin_text,
"text", g_strdup_printf(_("Skin : %s"),
(char *)g_list_nth_data(skinlist, skin_index)),
"text", skin_str,
NULL);
g_free(skin_str);
}
default:
break;
......
/* gcompris - gameutil.c
*
* Time-stamp: <2006/08/14 02:30:53 bruno>
* Time-stamp: <2006/08/15 04:27:21 bruno>
*
* Copyright (C) 2000-2006 Bruno Coudoin
*
......@@ -63,17 +63,20 @@ GdkPixbuf *gcompris_load_pixmap(char *pixmapfile)
/* Search */
filename = gcompris_find_absolute_filename(pixmapfile);
if (!filename)
{
pixmap = gc_net_load_pixmap(pixmapfile);
if(filename)
pixmap = gc_net_load_pixmap(filename);
if(!pixmap)
if (!filename || !pixmap)
{
char *str;
if(!pixmap)
g_warning("Loading image '%s' returned a null pointer", filename);
else
g_warning ("Couldn't find file %s !", pixmapfile);
str = g_strdup_printf("%s\n%s\n%s\n%s",
_("Couldn't find file"),
_("Couldn't find or load the file"),
pixmapfile,
_("This activity is incomplete."),
_("Exit it and report\nthe problem to the authors."));
......@@ -81,16 +84,9 @@ GdkPixbuf *gcompris_load_pixmap(char *pixmapfile)
g_free(str);
return NULL;
}
}
else
{
pixmap = gdk_pixbuf_new_from_file (filename, NULL);
}
g_free(filename);
if(!pixmap)
g_warning("Loading image '%s' returned a null pointer", filename);
return(pixmap);
}
......@@ -1080,6 +1076,7 @@ void gcompris_dialog(gchar *str, DialogBoxCallBack dbcb)
gdk_pixbuf_get_height(pixmap_dialog) - 35,
"anchor", GTK_ANCHOR_CENTER,
"fill_color_rgba", gcompris_skin_color_text_button,
"weight", PANGO_WEIGHT_HEAVY,
NULL);
gdk_pixbuf_unref(pixmap_dialog);
......@@ -1243,8 +1240,6 @@ gcompris_find_absolute_filename(const gchar *format, ...)
if (!format)
return NULL;
g_warning("format '%s'", format);
va_start (args, format);
filename = g_strdup_vprintf (format, args);
va_end (args);
......@@ -1252,8 +1247,9 @@ gcompris_find_absolute_filename(const gchar *format, ...)
g_warning("filename '%s'", filename);
/* Check it's already an absolute file */
if(g_path_is_absolute (filename) &&
if( ((g_path_is_absolute (filename) &&
g_file_test (filename, G_FILE_TEST_EXISTS))
|| gc_net_is_url(filename)) )
{
return filename;
}
......@@ -1288,11 +1284,19 @@ gcompris_find_absolute_filename(const gchar *format, ...)
g_strlcpy(locale, gcompris_get_locale(), sizeof(locale));
filename2 = g_strjoinv(locale, tmp);
absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename2);
g_free(filename2);
g_warning("1>>>> trying %s\n", absolute_filename);
if(g_file_test (absolute_filename, G_FILE_TEST_EXISTS))
{
g_strfreev(tmp);
g_free(filename2);
goto FOUND;
}
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename2, NULL)))
{
g_strfreev(tmp);
g_free(filename2);
goto FOUND;
}
......@@ -1303,20 +1307,36 @@ gcompris_find_absolute_filename(const gchar *format, ...)
filename2 = g_strjoinv(locale, tmp);
g_strfreev(tmp);
absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename2);
g_free(filename2);
g_warning("2>>>> trying %s\n", absolute_filename);
if(g_file_test (absolute_filename, G_FILE_TEST_EXISTS))
{
g_free(filename2);
goto FOUND;
}
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename2, NULL)))
{
g_free(filename2);
goto FOUND;
}
}
}
else
{
absolute_filename = g_strdup_printf("%s/%s", dir_to_search[i], filename);
}
i++;
if(g_file_test (absolute_filename, G_FILE_TEST_EXISTS))
goto FOUND;
/* Now check if this file is on the net */
if((absolute_filename = gc_net_get_url_from_file("boards/%s", filename, NULL)))
goto FOUND;
}
i++;
}
g_free(filename);
......
/* gcompris - gc_net.c
/* gcompris - gameutil_net.c
*
* Time-stamp: <2006/07/10 01:24:04 bruno>
*
......@@ -25,18 +25,70 @@
#include <gnet.h>
#endif
/*
* Init the network library, must be called once before using it
/* FIXME: Should not be needed, a bug in gnet header ? */
gboolean gnet_http_get (const gchar *url,
gchar **buffer,
gsize *length,
guint *response);
#include <string.h>
#ifdef USE_GNET
static GSList *server_content_list = NULL;
#define SUPPORT_OR_RETURN(rv) {if(!gcompris_get_properties()->server) return rv;}
#else
#define SUPPORT_OR_RETURN(rv) { return rv; }
#endif
static inline int my_strcmp(gchar *a, gchar *b) { return strcmp( a, b); }
/** Init the network library, must be called once before using it
*
*/
void gc_net_init()
{
SUPPORT_OR_RETURN();
}
/** Load a pixmap from the network
*
* \param pixmapfile : a full URL to the file to load as an image
* in case a local file is given, it will be loaded.
* \return a GdkPixbuf or NULL
*/
GdkPixbuf *gc_net_load_pixmap(const char *url)
{
if(!gc_net_is_url(url))
return(gdk_pixbuf_new_from_file (url, NULL));
SUPPORT_OR_RETURN(NULL);
}
/** return an absolute URL if the given file is part of the file available on our server
*
* \param file: the file to check
* \return: a newly allocated URL or NULL
*/
gchar *
gc_net_get_url_from_file(const gchar *format, ...)
{
SUPPORT_OR_RETURN(NULL);
}
/*
* load a pixmap from the network
* pixmapfile is given relative to PACKAGE_DATA_DIR
/** return TRUE if the url starts with http://
*
* \param url: an url to check
* \return TRUE is the url starts with 'http://'
*/
GdkPixbuf *gc_net_load_pixmap(char *pixmapfile)
gboolean
gc_net_is_url(const gchar *url)
{
return NULL;
if( !url || strncmp(url, "http://", 7) )
return FALSE;
return TRUE;
}
......@@ -33,6 +33,8 @@
#define GCOMPRIS_BASE_URL "http://gcompris.net/gcompris"
void gc_net_init();
GdkPixbuf *gc_net_load_pixmap(char *pixmapfile);
GdkPixbuf *gc_net_load_pixmap(const char *url);
gchar * gc_net_get_url_from_file(const gchar *format, ...);
gboolean gc_net_is_url(const char *url);
#endif
......@@ -81,7 +81,7 @@ static gint board_widget_key_press_callback (GtkWidget *widget,
gpointer client_data);
void gcompris_terminate(int signum);
GcomprisProperties *properties = NULL;
static GcomprisProperties *properties = NULL;
static gboolean antialiased = FALSE;
static gboolean is_mapped = FALSE;
......@@ -123,60 +123,91 @@ static int popt_no_quit = FALSE;
static int popt_no_config = FALSE;
static int popt_display_resource = FALSE;
static char *popt_server = NULL;
static int *popt_web_only = NULL;
static struct poptOption options[] = {
{"fullscreen", 'f', POPT_ARG_NONE, &popt_fullscreen, 0,
N_("run gcompris in fullscreen mode."), NULL},
{"window", 'w', POPT_ARG_NONE, &popt_window, 0,
N_("run gcompris in window mode."), NULL},
{"sound", 's', POPT_ARG_NONE, &popt_sound, 0,
N_("run gcompris with sound enabled."), NULL},
{"mute", 'm', POPT_ARG_NONE, &popt_mute, 0,
N_("run gcompris without sound."), NULL},
{"cursor", 'c', POPT_ARG_NONE, &popt_cursor, 0,
N_("run gcompris with the default gnome cursor."), NULL},
{"difficulty", 'd', POPT_ARG_INT, &popt_difficulty_filter, 0,
N_("display only activities with this difficulty level."), NULL},
{"debug", 'D', POPT_ARG_NONE, &popt_debug, 0,
N_("display debug informations on the console."), NULL},
{"version", 'v', POPT_ARG_NONE, &popt_version, 0,
N_("Print the version of " PACKAGE), NULL},
{"antialiased", '\0', POPT_ARG_NONE, &popt_aalias, 0,
N_("Use the antialiased canvas (slower)."), NULL},
{"noxf86vm", 'x', POPT_ARG_NONE, &popt_noxf86vm, 0,
N_("Disable XF86VidMode (No screen resolution change)."), NULL},
{"root-menu", 'l', POPT_ARG_STRING, &popt_root_menu, 0,