Commit c5886cd9 authored by Bruno Coudoin's avatar Bruno Coudoin

svn cleanup and fix bar unref

replaced non important warnings by messages to easy debuging

svn path=/branches/gcomprixogoo/; revision=3610
parent b41c54b3
...@@ -179,7 +179,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){ ...@@ -179,7 +179,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
execstr = g_strdup_printf("import sys; sys.path.append('%s')",properties->package_python_plugin_dir ); execstr = g_strdup_printf("import sys; sys.path.append('%s')",properties->package_python_plugin_dir );
#endif #endif
g_warning("Executing %s\n", execstr); g_message("Executing %s\n", execstr);
if(PyRun_SimpleString(execstr)!=0){ if(PyRun_SimpleString(execstr)!=0){
pythonboard_is_ready = FALSE; pythonboard_is_ready = FALSE;
g_warning("! Python disabled: Cannot add plugins dir into search path\n"); g_warning("! Python disabled: Cannot add plugins dir into search path\n");
...@@ -221,7 +221,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){ ...@@ -221,7 +221,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
/* Test if board come with --python_plugin_dir option */ /* Test if board come with --python_plugin_dir option */
g_warning("board_dir: '%s' python_plugin_dir '%s' file_name '%s'", g_message("board_dir: '%s' python_plugin_dir '%s' file_name '%s'",
board->board_dir, board->board_dir,
properties->package_python_plugin_dir, properties->package_python_plugin_dir,
board_file_name); board_file_name);
...@@ -241,7 +241,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){ ...@@ -241,7 +241,7 @@ pythonboard_init (GcomprisBoard *agcomprisBoard){
if (PyObject_HasAttrString( py_boardclass, "config_start")) { if (PyObject_HasAttrString( py_boardclass, "config_start")) {
config_boards = g_list_append(config_boards, board); config_boards = g_list_append(config_boards, board);
g_warning("The board '%s' has a configuration entry", g_message("The board '%s' has a configuration entry",
board_file_name); board_file_name);
} }
} }
......
...@@ -157,19 +157,19 @@ gboolean gc_db_init(gboolean disable_database_) ...@@ -157,19 +157,19 @@ gboolean gc_db_init(gboolean disable_database_)
/* if size of file is null, we recreate the tables */ /* if size of file is null, we recreate the tables */
if (buf.st_size == 0){ if (buf.st_size == 0){
creation = TRUE; creation = TRUE;
g_warning("Database file is empty! Trying to create table..."); g_message("Database file is empty! Trying to create table...");
} }
} }
#endif #endif
rc = sqlite3_open(properties->database, &gcompris_db); rc = sqlite3_open(properties->database, &gcompris_db);
if( rc ){ if( rc ){
g_warning("Can't open database %s : %s\n", properties->database, sqlite3_errmsg(gcompris_db)); g_message("Can't open database %s : %s\n", properties->database, sqlite3_errmsg(gcompris_db));
sqlite3_close(gcompris_db); sqlite3_close(gcompris_db);
exit(1); exit(1);
} }
g_warning("Database %s opened", properties->database); g_message("Database %s opened", properties->database);
if (creation){ if (creation){
/* create all tables needed */ /* create all tables needed */
...@@ -244,7 +244,7 @@ gboolean gc_db_init(gboolean disable_database_) ...@@ -244,7 +244,7 @@ gboolean gc_db_init(gboolean disable_database_)
g_error("SQL error: %s\n", zErrMsg); g_error("SQL error: %s\n", zErrMsg);
} }
g_warning("Database tables created"); g_message("Database tables created");
request = g_strdup_printf(SET_VERSION(VERSION)); request = g_strdup_printf(SET_VERSION(VERSION));
...@@ -305,7 +305,7 @@ gboolean gc_db_init(gboolean disable_database_) ...@@ -305,7 +305,7 @@ gboolean gc_db_init(gboolean disable_database_)
if (!(strcmp(result[1],"ok")==0)) if (!(strcmp(result[1],"ok")==0))
g_error("DATABASE integrity check returns %s \n", result[1]); g_error("DATABASE integrity check returns %s \n", result[1]);
g_warning("Database Integrity ok"); g_message("Database Integrity ok");
sqlite3_free_table(result); sqlite3_free_table(result);
rc = sqlite3_get_table(gcompris_db, rc = sqlite3_get_table(gcompris_db,
...@@ -320,7 +320,7 @@ gboolean gc_db_init(gboolean disable_database_) ...@@ -320,7 +320,7 @@ gboolean gc_db_init(gboolean disable_database_)
} }
if (strcmp(result[1],VERSION)!=0) if (strcmp(result[1],VERSION)!=0)
g_warning("Running GCompris is %s, but database version is %s", VERSION, result[1]); g_message("Running GCompris is %s, but database version is %s", VERSION, result[1]);
sqlite3_free_table(result); sqlite3_free_table(result);
/* Schema upgrade */ /* Schema upgrade */
...@@ -339,7 +339,7 @@ gboolean gc_db_init(gboolean disable_database_) ...@@ -339,7 +339,7 @@ gboolean gc_db_init(gboolean disable_database_)
sqlite3_free_table(result); sqlite3_free_table(result);
if(version <= 16) if(version <= 16)
{ {
g_warning("Upgrading from <16 schema version\n"); g_message("Upgrading from <16 schema version\n");
rc = sqlite3_exec(gcompris_db,CREATE_TABLE_LOGS, NULL, 0, &zErrMsg); rc = sqlite3_exec(gcompris_db,CREATE_TABLE_LOGS, NULL, 0, &zErrMsg);
if( rc!=SQLITE_OK ) { if( rc!=SQLITE_OK ) {
g_error("SQL error: %s\n", zErrMsg); g_error("SQL error: %s\n", zErrMsg);
...@@ -359,7 +359,7 @@ gboolean gc_db_exit() ...@@ -359,7 +359,7 @@ gboolean gc_db_exit()
#ifdef USE_SQLITE #ifdef USE_SQLITE
sqlite3_close(gcompris_db); sqlite3_close(gcompris_db);
g_warning("Database closed"); g_message("Database closed");
return TRUE; return TRUE;
#endif #endif
} }
...@@ -934,7 +934,7 @@ GcomprisProfile *gc_db_get_profile_from_id(gint profile_id) ...@@ -934,7 +934,7 @@ GcomprisProfile *gc_db_get_profile_from_id(gint profile_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No users' groups for profile %s", profile->name); g_message("No users' groups for profile %s", profile->name);
profile->group_ids = NULL; profile->group_ids = NULL;
} else { } else {
ids = NULL; ids = NULL;
...@@ -966,7 +966,7 @@ GcomprisProfile *gc_db_get_profile_from_id(gint profile_id) ...@@ -966,7 +966,7 @@ GcomprisProfile *gc_db_get_profile_from_id(gint profile_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No activities for profile %s", profile->name); g_message("No activities for profile %s", profile->name);
profile->activities = NULL; profile->activities = NULL;
} else { } else {
ids = NULL; ids = NULL;
...@@ -1111,7 +1111,7 @@ GList *gc_db_users_from_group_get(gint group_id) ...@@ -1111,7 +1111,7 @@ GList *gc_db_users_from_group_get(gint group_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No users in the group id %d", group_id); g_message("No users in the group id %d", group_id);
} else { } else {
i = ncolumn; i = ncolumn;
while (i < (nrow +1)*ncolumn) { while (i < (nrow +1)*ncolumn) {
...@@ -1167,7 +1167,7 @@ GcomprisUser *gc_db_get_user_from_id(gint user_id) ...@@ -1167,7 +1167,7 @@ GcomprisUser *gc_db_get_user_from_id(gint user_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No user with id %d", user_id); g_message("No user with id %d", user_id);
return NULL; return NULL;
} else { } else {
i = ncolumn; i = ncolumn;
...@@ -1223,7 +1223,7 @@ GcomprisClass *gc_db_get_class_from_id(gint class_id) ...@@ -1223,7 +1223,7 @@ GcomprisClass *gc_db_get_class_from_id(gint class_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No class with id %d", class_id); g_message("No class with id %d", class_id);
return NULL; return NULL;
return NULL; return NULL;
} else { } else {
...@@ -1392,7 +1392,7 @@ GHashTable *gc_db_conf_with_table_get(int profile_id, int board_id, ...@@ -1392,7 +1392,7 @@ GHashTable *gc_db_conf_with_table_get(int profile_id, int board_id,
request = g_strdup_printf(GET_CONF(profile_id, request = g_strdup_printf(GET_CONF(profile_id,
board_id)); board_id));
g_warning ( "Request get_conf : %s", request); g_message ( "Request get_conf : %s", request);
rc = sqlite3_get_table(gcompris_db, rc = sqlite3_get_table(gcompris_db,
request, request,
...@@ -1414,7 +1414,7 @@ GHashTable *gc_db_conf_with_table_get(int profile_id, int board_id, ...@@ -1414,7 +1414,7 @@ GHashTable *gc_db_conf_with_table_get(int profile_id, int board_id,
g_hash_table_replace (hash_conf, g_hash_table_replace (hash_conf,
g_strdup(result[i]), g_strdup(result[i]),
g_strdup(result[i+1])); g_strdup(result[i+1]));
g_warning("get_conf: put key %s value %s in the hash", g_message("get_conf: put key %s value %s in the hash",
result[i], result[i],
result[i+1]); result[i+1]);
} }
...@@ -1534,7 +1534,7 @@ GList *gc_db_profiles_list_get() ...@@ -1534,7 +1534,7 @@ GList *gc_db_profiles_list_get()
g_free(request); g_free(request);
if (nrow_ == 0){ if (nrow_ == 0){
g_warning("No users groups for profile %s", profile->name); g_message("No users groups for profile %s", profile->name);
profile->group_ids = NULL; profile->group_ids = NULL;
} else { } else {
ids_ = NULL; ids_ = NULL;
...@@ -1567,7 +1567,7 @@ GList *gc_db_profiles_list_get() ...@@ -1567,7 +1567,7 @@ GList *gc_db_profiles_list_get()
g_free(request); g_free(request);
if (nrow_ == 0){ if (nrow_ == 0){
g_warning("No activities out for profile %s", profile->name); g_message("No activities out for profile %s", profile->name);
profile->activities = NULL; profile->activities = NULL;
} else { } else {
ids_ = NULL; ids_ = NULL;
...@@ -1627,7 +1627,7 @@ GcomprisGroup *gc_db_get_group_from_id(int group_id) ...@@ -1627,7 +1627,7 @@ GcomprisGroup *gc_db_get_group_from_id(int group_id)
g_free(request); g_free(request);
if (nrow == 0){ if (nrow == 0){
g_warning("No group with id %d", group_id); g_message("No group with id %d", group_id);
return NULL; return NULL;
} else { } else {
i = ncolumn; i = ncolumn;
...@@ -1678,7 +1678,7 @@ GList *gc_db_get_groups_list() ...@@ -1678,7 +1678,7 @@ GList *gc_db_get_groups_list()
} }
if (nrow == 0){ if (nrow == 0){
g_warning("No groups !"); g_message("No groups !");
return NULL; return NULL;
} else { } else {
i = ncolumn; i = ncolumn;
...@@ -1813,7 +1813,7 @@ GList *gc_db_get_users_list() ...@@ -1813,7 +1813,7 @@ GList *gc_db_get_users_list()
} }
if (nrow == 0){ if (nrow == 0){
g_warning("No users !"); g_message("No users !");
return NULL; return NULL;
} else { } else {
i = ncolumn; i = ncolumn;
...@@ -1867,7 +1867,7 @@ GList *gc_db_get_classes_list() ...@@ -1867,7 +1867,7 @@ GList *gc_db_get_classes_list()
} }
if (nrow == 0){ if (nrow == 0){
g_warning("No groups !"); g_message("No groups !");
return NULL; return NULL;
} else { } else {
i = ncolumn; i = ncolumn;
......
...@@ -46,10 +46,11 @@ goo_canvas_svg_install_common_properties (GObjectClass *gobject_class) ...@@ -46,10 +46,11 @@ goo_canvas_svg_install_common_properties (GObjectClass *gobject_class)
} }
static void _init_surface(GooCanvasSvg *canvas_svg) static void _init_surface(GooCanvasSvg *canvas_svg,
RsvgHandle *svg_handle)
{ {
RsvgDimensionData dimension_data; RsvgDimensionData dimension_data;
rsvg_handle_get_dimensions (canvas_svg->svg_handle, &dimension_data); rsvg_handle_get_dimensions (svg_handle, &dimension_data);
canvas_svg->width = dimension_data.width; canvas_svg->width = dimension_data.width;
canvas_svg->height = dimension_data.height; canvas_svg->height = dimension_data.height;
...@@ -66,7 +67,7 @@ static void _init_surface(GooCanvasSvg *canvas_svg) ...@@ -66,7 +67,7 @@ static void _init_surface(GooCanvasSvg *canvas_svg)
canvas_svg->width, canvas_svg->width,
canvas_svg->height); canvas_svg->height);
canvas_svg->cr = cairo_create (cst); canvas_svg->cr = cairo_create (cst);
rsvg_handle_render_cairo (canvas_svg->svg_handle, canvas_svg->cr); rsvg_handle_render_cairo (svg_handle, canvas_svg->cr);
canvas_svg->pattern = cairo_pattern_create_for_surface (cst); canvas_svg->pattern = cairo_pattern_create_for_surface (cst);
cairo_surface_destroy(cst); cairo_surface_destroy(cst);
} }
...@@ -100,9 +101,8 @@ goo_canvas_svg_new (GooCanvasItem *parent, ...@@ -100,9 +101,8 @@ goo_canvas_svg_new (GooCanvasItem *parent,
item = g_object_new (GOO_TYPE_CANVAS_SVG, NULL); item = g_object_new (GOO_TYPE_CANVAS_SVG, NULL);
canvas_svg = (GooCanvasSvg*) item; canvas_svg = (GooCanvasSvg*) item;
canvas_svg->svg_handle = svg_handle;
if(svg_handle) if(svg_handle)
_init_surface(canvas_svg); _init_surface(canvas_svg, svg_handle);
va_start (var_args, svg_handle); va_start (var_args, svg_handle);
first_property = va_arg (var_args, char*); first_property = va_arg (var_args, char*);
...@@ -147,12 +147,11 @@ goo_canvas_svg_paint (GooCanvasItemSimple *simple, ...@@ -147,12 +147,11 @@ goo_canvas_svg_paint (GooCanvasItemSimple *simple,
{ {
GooCanvasSvg *canvas_svg = (GooCanvasSvg*) simple; GooCanvasSvg *canvas_svg = (GooCanvasSvg*) simple;
if(canvas_svg->svg_handle) if(canvas_svg->pattern)
{ {
cairo_set_source (cr, canvas_svg->pattern); cairo_set_source (cr, canvas_svg->pattern);
cairo_paint (cr); cairo_paint (cr);
} }
//rsvg_handle_render_cairo_sub (canvas_svg->svg_handle, cr, canvas_svg->id);
} }
...@@ -161,11 +160,6 @@ goo_canvas_svg_finalize (GObject *object) ...@@ -161,11 +160,6 @@ goo_canvas_svg_finalize (GObject *object)
{ {
GooCanvasSvg *canvas_svg = (GooCanvasSvg*) object; GooCanvasSvg *canvas_svg = (GooCanvasSvg*) object;
/* Free our data if we didn't have a model. */
if(canvas_svg->svg_handle)
g_object_unref (canvas_svg->svg_handle);
canvas_svg->svg_handle = NULL;
if (canvas_svg->id) if (canvas_svg->id)
g_free(canvas_svg->id); g_free(canvas_svg->id);
canvas_svg->id = NULL; canvas_svg->id = NULL;
...@@ -196,8 +190,7 @@ goo_canvas_svg_set_common_property (GObject *object, ...@@ -196,8 +190,7 @@ goo_canvas_svg_set_common_property (GObject *object,
{ {
case PROP_SVGHANDLE: case PROP_SVGHANDLE:
svg_handle = g_value_get_object (value); svg_handle = g_value_get_object (value);
canvas_svg->svg_handle = svg_handle; _init_surface(canvas_svg, svg_handle);
_init_surface(canvas_svg);
break; break;
case PROP_SVG_ID: case PROP_SVG_ID:
if (!g_value_get_string (value)) if (!g_value_get_string (value))
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#ifndef __GOO_CANVAS_SVG_H__ #ifndef __GOO_CANVAS_SVG_H__
#define __GOO_CANVAS_SVG_H__ #define __GOO_CANVAS_SVG_H__
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "goocanvasitemsimple.h" #include "goocanvasitemsimple.h"
#include <librsvg/rsvg.h>
#include <librsvg/rsvg-cairo.h>
G_BEGIN_DECLS G_BEGIN_DECLS
...@@ -30,7 +30,6 @@ struct _GooCanvasSvg ...@@ -30,7 +30,6 @@ struct _GooCanvasSvg
{ {
GooCanvasItemSimple parent_object; GooCanvasItemSimple parent_object;
RsvgHandle *svg_handle;
gdouble width, height; gdouble width, height;
gchar *id; gchar *id;
cairo_t *cr; cairo_t *cr;
......
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