Commit aa06126a authored by Bruno Coudoin's avatar Bruno Coudoin

Minor change. Now if we don't find the cursor image, we fallback to the default X cursor.

parent 99295419
......@@ -448,7 +448,8 @@ static void
bar_hide (gboolean hide)
{
/* Non yet initialized : Something Wrong */
g_assert(rootitem);
if ( ! rootitem )
return;
_hidden = hide;
......
......@@ -505,31 +505,31 @@ void gc_cursor_set(guint gdk_cursor_type)
switch (gdk_cursor_type) {
case GCOMPRIS_DEFAULT_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/default.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/default.png");
break;
case GCOMPRIS_LINE_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/line.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/line.png");
break;
case GCOMPRIS_RECT_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/rect.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/rect.png");
break;
case GCOMPRIS_FILLRECT_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/fillrect.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/fillrect.png");
break;
case GCOMPRIS_CIRCLE_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/circle.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/circle.png");
break;
case GCOMPRIS_FILLCIRCLE_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/fillcircle.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/fillcircle.png");
break;
case GCOMPRIS_FILL_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/fill.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/fill.png");
break;
case GCOMPRIS_DEL_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/del.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/del.png");
break;
case GCOMPRIS_SELECT_CURSOR :
cursor_pixbuf = gc_skin_pixmap_load("cursors/select.png");
cursor_pixbuf = gc_skin_pixmap_load_or_null("cursors/select.png");
break;
default :
return;
......@@ -544,6 +544,13 @@ void gc_cursor_set(guint gdk_cursor_type)
gdk_cursor_unref(cursor);
gdk_pixbuf_unref(cursor_pixbuf);
}
else
{
/* The cursor image was not found, falback to default one */
properties->defaultcursor = GDK_LEFT_PTR;
gc_cursor_set(GCOMPRIS_DEFAULT_CURSOR);
return;
}
}
gc_cursor_current = gdk_cursor_type;
}
......
......@@ -84,7 +84,27 @@ gc_skin_image_get(gchar *pixmapfile)
/*
* Load a pixmap from the current skin directory
* If not found, try in the default skin directory
* If not found abort gcompris
* If not found returns NULL
*/
GdkPixbuf *
gc_skin_pixmap_load_or_null(char *pixmapfile)
{
gchar *filename;
GdkPixbuf *result_pixbuf;
filename = gc_skin_image_get(pixmapfile);
result_pixbuf = gc_pixmap_load_or_null (filename);
g_free(filename);
return (result_pixbuf);
}
/*
* Load a pixmap from the current skin directory
* If not found, try in the default skin directory
* If not found returns a small 1x1 pixmap
*/
GdkPixbuf *
gc_skin_pixmap_load(char *pixmapfile)
......
......@@ -45,6 +45,7 @@ extern gchar* gc_skin_font_board_huge_bold;
gchar *gc_skin_image_get(gchar *imagename);
GdkPixbuf *gc_skin_pixmap_load_or_null(char *pixmapfile);
GdkPixbuf *gc_skin_pixmap_load(char *pixmapfile);
RsvgHandle *gc_skin_rsvg_get();
RsvgHandle *gc_skin_rsvg_load(char *pixmapfile);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment