Back to index

gcompris  8.2.2
Classes | Typedefs | Functions
profile.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _GcomprisClass
struct  _GcomprisGroup
struct  _GcomprisUser
struct  GcomprisProfile

Typedefs

typedef struct _GcomprisClass
typedef struct _GcomprisGroup
typedef struct _GcomprisUser

Functions

GcomprisGroup * gc_profile_group_load (gint *group_id)
GcomprisProfilegc_profile_get_current ()
 Return the current profile or NULL if sqlite not activated.
void gc_profile_destroy (GcomprisProfile *prof)
void gc_user_destroy (GcomprisUser *user)
void gc_profile_set_current_user (GcomprisUser *user)
GcomprisUser * gc_profile_get_current_user ()

Class Documentation

struct _GcomprisClass

Definition at line 38 of file profile.h.

Class Members
gint class_id
gchar * description
GList * group_ids
gchar * name
GList * user_ids
gint wholegroup_id
struct _GcomprisGroup

Definition at line 65 of file profile.h.

Class Members
gint class_id
gchar * description
gint group_id
gchar * name
GList * user_ids
struct _GcomprisUser

Definition at line 92 of file profile.h.

Class Members
gchar * birthdate
gint class_id
gchar * firstname
gchar * lastname
gchar * login
guint session_id
gint user_id
struct GcomprisProfile

Definition at line 120 of file profile.h.

Class Members
GList * activities
gchar * description
gchar * directory
GList * group_ids
gchar * name
gint profile_id

Typedef Documentation

typedef struct _GcomprisClass

Definition at line 57 of file profile.h.

typedef struct _GcomprisGroup

Definition at line 81 of file profile.h.

typedef struct _GcomprisUser

Definition at line 114 of file profile.h.


Function Documentation

Definition at line 83 of file profile.c.

{
  if(!prof)
    return;

  g_free(prof->name);
  g_free(prof->directory);
  g_free(prof->description);
  g_free(prof);
}

Here is the caller graph for this function:

Return the current profile or NULL if sqlite not activated.

Definition at line 30 of file profile.c.

{
  GcomprisProperties *properties = gc_prop_get();

  if (properties->profile)
    return properties->profile;

  properties->profile = gc_db_get_profile();

  return properties->profile;

}

Here is the call graph for this function:

Here is the caller graph for this function:

GcomprisUser* gc_profile_get_current_user ( )

Definition at line 107 of file profile.c.

{
  GcomprisProperties *properties = gc_prop_get();
  return properties->logged_user;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GcomprisGroup* gc_profile_group_load ( gint *  group_id)
void gc_profile_set_current_user ( GcomprisUser *  user)

Definition at line 45 of file profile.c.

{
  GcomprisProperties *properties = gc_prop_get();

  if (user)
    properties->logged_user = user;
  else {
    g_warning("No user, getting one from system.");
    GcomprisUser *sys_user = g_malloc0(sizeof(GcomprisUser));

    const gchar *user_name = g_get_user_name ();
    if (user_name)
      sys_user->login = g_strdup(user_name);
    else
      sys_user->login = g_strdup("nobody");

    const gchar *last_name = g_get_real_name ();
    if (last_name)
      sys_user->lastname = g_strdup(last_name);
    else
      sys_user->lastname = g_strdup("Nobody There ?");

    sys_user->firstname = g_strdup("Unknown");
    sys_user->birthdate = g_strdup("");

    properties->logged_user = sys_user;
  }

  GTimeVal now;
  g_get_current_time (&now);

  gchar *session_id_str = g_strdup_printf("%s%ld%ld", (properties->logged_user)->login, now.tv_sec, now.tv_usec);

  (properties->logged_user)->session_id = g_str_hash((gconstpointer) session_id_str);
  g_free(session_id_str);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_user_destroy ( GcomprisUser *  user)

Definition at line 94 of file profile.c.

{
  if(!user)
    return;

  g_free(user->login);
  g_free(user->lastname);
  g_free(user->firstname);
  g_free(user->birthdate);
  g_free(user);
}

Here is the caller graph for this function: