Back to index

gcompris  8.2.2
gcompris_db.h
Go to the documentation of this file.
00001 /* gcompris - gcompris_db.h
00002  *
00003  * Time-stamp: <2006/07/10 00:48:16 bruno>
00004  *
00005  * Copyright (C) 2005 Bruno Coudoin
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00020  */
00021 
00022 
00023 #ifndef GCOMPRIS_DB_H
00024 #define GCOMPRIS_DB_H
00025 
00026 #ifdef USE_SQLITE
00027 #include <sqlite3.h>
00028 #endif
00029 
00030 /* Database management */
00031 int gc_db_init();
00032 void gc_db_exit();
00033 
00034 gboolean gc_db_check_boards();
00035 
00036 void gc_db_set_date(gchar *date);
00037 
00038 void gc_db_set_version(gchar *version);
00039 
00040 void gc_db_board_update(guint *board_id, 
00041                            guint *section_id, 
00042                            gchar *name, 
00043                            gchar *section, 
00044                            gchar *author, 
00045                            gchar *type, 
00046                            gchar *mode, 
00047                            int difficulty, 
00048                            gchar *icon, 
00049                            gchar *boarddir,
00050                            gchar *mandatory_sound_file,
00051                            gchar *mandatory_sound_dataset,
00052                            gchar *filename,
00053                            gchar *title, 
00054                            gchar *description, 
00055                            gchar *prerequisite, 
00056                            gchar *goal, 
00057                            gchar *manual,
00058                            gchar *credit
00059                            );
00060 
00061 void gc_db_save_user(int *user_id,
00062                         gchar *login,
00063                         gchar *name,
00064                         gchar *firstname,
00065                         gchar *birthday,
00066                         int class_id);
00067 
00068 GList *gc_db_read_board_from_section(gchar *section);
00069 
00070 GList *gc_menu_load_db(GList *boards);
00071 
00072 GList *gc_db_get_board_id(GList *list);
00073 
00074 void gc_db_remove_board(int board_id);
00075 
00076 
00077 /* Profile management */
00078 
00079 GcomprisProfile *gc_db_get_profile_from_id(gint profile_id);
00080 GcomprisProfile *gc_db_profile_from_name_get(gchar *profile_name);
00081 GList *gc_db_profiles_list_get();
00082 
00083 
00084 /* Classes management */
00085 
00086 GcomprisClass *gc_db_get_class_from_id(gint class_id);
00087 
00088 GList *gc_db_get_classes_list();
00089 
00090 GcomprisGroup *gc_db_get_group_from_id(gint group_id);
00091 
00092 GList *gc_db_get_groups_list();
00093 
00094 GcomprisUser *gc_db_get_user_from_id(gint user_id);
00095 
00096 GList *gc_db_get_users_list();
00097 
00098 GcomprisProfile *gc_db_get_profile();
00099 
00100 GList *gc_db_users_from_group_get(gint group_id);
00101 
00102 void gc_db_set_board_conf(GcomprisProfile *profile, 
00103                           GcomprisBoard  *board, 
00104                           gchar *key, 
00105                           gchar *value);
00106 
00107 
00108 /* These two hash tables needs to be destroyed when not used more */
00109 
00110 /* get conf for currents profile and board */
00111 GHashTable *gc_db_get_board_conf();
00112 
00113 /* get conf for specific profile and board */
00114 GHashTable *gc_db_get_conf(GcomprisProfile *profile, GcomprisBoard  *board);
00115 
00116 /*internal initialisation use only, do not use it for boards*/
00117 GHashTable *gc_db_conf_with_table_get(int profile_id, int board_id, GHashTable *table );
00118 
00119 GcomprisBoard *gc_db_get_board_from_id(int board_id);
00120 
00121 int gc_db_is_activity_in_profile(GcomprisProfile *profile, char *activity_name);
00122 
00123 #endif
00124 
00125 /* Local Variables: */
00126 /* mode:c */
00127 /* eval:(load-library "time-stamp") */
00128 /* eval:(make-local-variable 'write-file-hooks) */
00129 /* eval:(add-hook 'write-file-hooks 'time-stamp) */
00130 /* eval:(setq time-stamp-format '(time-stamp-yyyy/mm/dd time-stamp-hh:mm:ss user-login-name)) */
00131 /* End: */