Back to index

gcompris  8.2.2
profile.h
Go to the documentation of this file.
00001 /* gcompris - profile.h
00002  *
00003  * Time-stamp: <2006/08/29 01:16:51 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 /* this files describes structures and fucntions for profile management.     */
00024 /* GcomprisClass is intended as school class, and defines a partition of     */
00025 /* set of all users. Each user is in a class and only one.                   */
00026 /* GcomprisGroup is a subset of class. It's not a partition of the class,    */
00027 /* user can be in 1 or more groups.                                          */
00028 /* There is at least one group in a class -- the whole class.                */
00029 /* GcomprisUser is the structure defining a user.                            */
00030 /* GcomprisProfile is the strucuture for the profile                         */
00031 /*****************************************************************************/
00032 
00033 #ifndef PROFILES_H
00034 #define PROFILES_H
00035 
00036 /*****************************************************************************/
00037 /* The following structure dsecribes a class, partitionning the users set     */
00038 struct _GcomprisClass {
00039   gint                class_id;
00040 
00041   /* name of class -- must be unique */
00042   gchar               *name;
00043 
00044   /* description */
00045   gchar               *description;
00046 
00047   /* Group id for whole class */
00048   gint                wholegroup_id;
00049 
00050   /* list of GComprisGroup id */
00051   GList               *group_ids;
00052 
00053   /* list of GComprisUser id */
00054   GList               *user_ids;
00055 };
00056 
00057 typedef struct _GcomprisClass  GcomprisClass;
00058 
00059 
00060 /*****************************************************************************/
00061 /* The following structure describes a group, subset of class  */
00062 
00063 /* group data is saved when class is saved */
00064 
00065 struct _GcomprisGroup {
00066   gint                group_id;
00067 
00068   /*name of group -- must be unique */
00069   gchar               *name;
00070   
00071   /* GcomprisClass containing the group */
00072   gint                class_id;
00073 
00074   /* list of GComprisUser user_id */
00075   GList               *user_ids;
00076 
00077   /* description */
00078   gchar               *description;
00079 };
00080 
00081 typedef struct _GcomprisGroup GcomprisGroup;
00082 
00083 /* find a group */
00084 GcomprisGroup         *gc_profile_group_load(gint *group_id);
00085 
00086 /*****************************************************************************/
00087 /* The following structure dsecribes a user */
00088 
00089 /* users data is saved when class is saved */
00090 
00091 
00092 struct _GcomprisUser {
00093   gint               user_id;
00094 
00095   /* The login name -- must be unique */
00096   gchar             *login;
00097 
00098   /* mandatory class */
00099   gint               class_id;
00100 
00101   /* Last Name */
00102   gchar             *lastname;
00103   
00104   /* First Name */
00105   gchar             *firstname;
00106 
00107   /* Birth day */
00108   gchar             *birthdate;
00109 
00110   /* Unique Session ID */
00111   guint             session_id;
00112 };
00113 
00114 typedef struct _GcomprisUser GcomprisUser;
00115 
00116 
00117 /*****************************************************************************/
00118 /* The following structure describes a profile object.  */
00119 
00120 typedef struct {
00121   /* Profile Name */
00122   gint               profile_id;
00123   gchar             *name;
00124 
00125   /* The subdirectory into the user gcompris dir */
00126   gchar                  *directory;
00127 
00128   gchar             *description;
00129 
00130   /* list of GcomprisGroup. if empty user management is disabled */
00131   GList             *group_ids; 
00132 
00133   /* list of activities to play -- gchar section/name */
00134   GList             *activities;
00135 
00136 } GcomprisProfile;
00137 
00138 
00139 /* Active profile */
00140 GcomprisProfile     *gc_profile_get_current();
00141 void gc_profile_destroy(GcomprisProfile *prof);
00142 void gc_user_destroy(GcomprisUser *user);
00143 
00144 /* List of Gcomprisusers */
00145 void                 gc_profile_set_current_user(GcomprisUser *user);
00146 GcomprisUser        *gc_profile_get_current_user();
00147 
00148 #endif