Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/gcompris/profile.h
blob: c4df56c6959bc3765b6a257c04966064efaab259 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/* gcompris - profile.h
 *
 * Copyright (C) 2005 Bruno Coudoin
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

/*****************************************************************************/
/* this files describes structures and fucntions for profile management.     */
/* GcomprisClass is intended as school class, and defines a partition of     */
/* set of all users. Each user is in a class and only one.                   */
/* GcomprisGroup is a subset of class. It's not a partition of the class,    */
/* user can be in 1 or more groups.                                          */
/* There is at least one group in a class -- the whole class.                */
/* GcomprisUser is the structure defining a user.                            */
/* GcomprisProfile is the strucuture for the profile                         */
/*****************************************************************************/

#ifndef PROFILES_H
#define PROFILES_H

/*****************************************************************************/
/* The following structure dsecribes a class, partitionning the users set     */
struct _GcomprisClass {
  gint                class_id;

  /* name of class -- must be unique */
  gchar               *name;

  /* description */
  gchar               *description;

  /* Group id for whole class */
  gint                wholegroup_id;

  /* list of GComprisGroup id */
  GList               *group_ids;

  /* list of GComprisUser id */
  GList               *user_ids;
};

typedef struct _GcomprisClass  GcomprisClass;


/*****************************************************************************/
/* The following structure describes a group, subset of class  */

/* group data is saved when class is saved */

struct _GcomprisGroup {
  gint                group_id;

  /*name of group -- must be unique */
  gchar               *name;

  /* GcomprisClass containing the group */
  gint                class_id;

  /* list of GComprisUser user_id */
  GList               *user_ids;

  /* description */
  gchar               *description;
};

typedef struct _GcomprisGroup GcomprisGroup;

/* find a group */
GcomprisGroup         *gc_profile_group_load(gint *group_id);

/*****************************************************************************/
/* The following structure dsecribes a user */

/* users data is saved when class is saved */


struct _GcomprisUser {
  gint               user_id;

  /* The login name -- must be unique */
  gchar             *login;

  /* mandatory class */
  gint               class_id;

  /* Last Name */
  gchar             *lastname;

  /* First Name */
  gchar             *firstname;

  /* Birth day */
  gchar             *birthdate;

  /* Unique Session ID */
  guint             session_id;
};

typedef struct _GcomprisUser GcomprisUser;


/*****************************************************************************/
/* The following structure describes a profile object.  */

typedef struct {
  /* Profile Name */
  gint               profile_id;
  gchar             *name;

  /* The subdirectory into the user gcompris dir */
  gchar		    *directory;

  gchar             *description;

  /* list of GcomprisGroup. if empty user management is disabled */
  GList             *group_ids;

  /* list of activities to play -- gchar section/name */
  GList             *activities;

} GcomprisProfile;


/* Active profile */
GcomprisProfile     *gc_profile_get_current();
void gc_profile_destroy(GcomprisProfile *prof);
void gc_user_destroy(GcomprisUser *user);

/* List of Gcomprisusers */
void                 gc_profile_set_current_user(GcomprisUser *user);
GcomprisUser        *gc_profile_get_current_user();

#endif