Back to index

gcompris  8.2.2
Functions
gc_core.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void gc_help_start (GcomprisBoard *gcomprisBoard)
 These are the functions shared in the GCompris core only, not available to activity code.
void gc_help_stop ()
gboolean gc_help_has_board (GcomprisBoard *gcomprisBoard)
 Return true wether the given board has at least one help field defined.
void gc_about_start (void)
 about dialog
void gc_about_stop (void)
void gc_exit ()
 miscelaneous functions
void gc_fullscreen_set (gboolean state)
 toggle full screen mode
int file_end_with_xml (const gchar *file)
 Select only files with .xml extention.
void gc_menu_load ()
 menu
void gc_menu_destroy (void)
void gc_mime_type_load ()
 mimetype
void gc_log_start (GcomprisBoard *gcomprisBoard)
 log
void gc_log_set_key (GcomprisBoard *gcomprisBoard, guint keyval)
 gc_log_key
void gc_cache_init (int max_size)
 cache
void gc_cache_end ()
 End the cache system.
void gc_cache_clear ()
 Clear the cache.
gchar * gc_cache_get (gchar *url)
 Get a file from the cache based on it's URL.
gchar * gc_cache_insert (const gchar *url, const char *buffer, gssize length)
 Put and Get a file from the cache.

Function Documentation

int file_end_with_xml ( const gchar *  file)

Select only files with .xml extention.

Return 1 if the given file end in .xml 0 else

Definition at line 462 of file menu.c.

{

  if(strlen(file)<4)
    return 0;

  return (strncmp (&file[strlen(file)-4], ".xml", 4) == 0);
}

Here is the caller graph for this function:

void gc_about_start ( void  )

about dialog

Definition at line 47 of file about.c.

{
  GdkPixbuf   *pixmap = NULL;
  gint y_start = 0;
  gint x_start = 0;
  gint x_text_start = 0;
  gint x_flag_start = 0;
  gint y = 0;
  GnomeCanvasItem *item, *item2;
  static gchar *content =
    N_("Author: Bruno Coudoin\n"
       "Contribution: Pascal Georges, Jose Jorge\n"
       "Graphics: Renaud Blanchard, Franck Doucet\n"
       "Intro Music: Djilali Sebihi\n"
       "Background Music: Rico Da Halvarez\n"
       );

  /* TRANSLATORS: Replace this string with your names, one name per line. */
  gchar *translators = _("translator_credits");

  /* Pause the board */
  gc_board_pause(TRUE);

  if(rootitem)
    return;

  gc_bar_hide (TRUE);

  rootitem = \
    gnome_canvas_item_new (gnome_canvas_root(gc_get_canvas()),
                        gnome_canvas_group_get_type (),
                        "x", (double)0,
                        "y", (double)0,
                        NULL);

  pixmap = gc_skin_pixmap_load("help_bg.png");
  y_start = (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  x_start = (BOARDWIDTH - gdk_pixbuf_get_width(pixmap))/2;
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) x_start,
                            "y", (double) y_start,
                            NULL);
  y = BOARDHEIGHT - (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  gdk_pixbuf_unref(pixmap);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", _("About GCompris"),
                      "font", gc_skin_font_title,
                      "x", (double) BOARDWIDTH/2 + 1.0,
                      "y", (double) y_start + 40 + 1.0,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_shadow,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);
  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", _("About GCompris"),
                      "font", gc_skin_font_title,
                      "x", (double) BOARDWIDTH/2,
                      "y", (double) y_start + 40,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_title,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", _("Translators:"),
                      "font", gc_skin_font_subtitle,
                      "x", (double) BOARDWIDTH/2-320,
                      "y", (double) y_start + 90,
                      "anchor", GTK_ANCHOR_NORTH_WEST,
                      "fill_color_rgba", gc_skin_color_subtitle,
                      NULL);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", translators,
                      "font", gc_skin_font_content,
                      "x", (double)  BOARDWIDTH/2-320,
                      "y", (double)  y_start + 120,
                      "anchor", GTK_ANCHOR_NORTH_WEST,
                      "fill_color_rgba", gc_skin_color_content,
                      NULL);
  // Version
  y_start += 100;

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", "GCompris V" VERSION,
                      "font", gc_skin_font_title,
                      "x", (double)  BOARDWIDTH/2,
                      "y", (double)  y_start,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_subtitle,
                      NULL);

  y_start += 140;
  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", gettext(content),
                      "font", gc_skin_font_content,
                      "x", (double) BOARDWIDTH/2-320,
                      "y", (double)  y_start,
                      "anchor", GTK_ANCHOR_NORTH_WEST,
                      "fill_color_rgba", gc_skin_color_content,
                      NULL);

  y_start += 40;
  // FSF Reference
  pixmap = gc_skin_pixmap_load("fsflogo.png");
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) (BOARDWIDTH*0.8) - gdk_pixbuf_get_width(pixmap)/2,
                            "y", (double) y_start - gdk_pixbuf_get_height(pixmap)/2,
                            NULL);
  gdk_pixbuf_unref(pixmap);

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", "Free Software Foundation\nhttp://www.fsf.org",
                            "font", gc_skin_font_content,
                            "x", (double)  (BOARDWIDTH*0.75),
                            "y", (double)  y_start + 80,
                            "anchor", GTK_ANCHOR_CENTER,
                            "fill_color_rgba", gc_skin_color_subtitle,
                            NULL);

  // GCompris Reference
  y_start += 80;
  pixmap = gc_skin_pixmap_load("gcomprislogo.png");
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) (BOARDWIDTH*0.3) - gdk_pixbuf_get_width(pixmap)/2 -50,
                            "y", (double) y_start - gdk_pixbuf_get_height(pixmap)/2,
                            NULL);

  gdk_pixbuf_unref(pixmap);

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", _("GCompris Home Page\nhttp://gcompris.net"),
                            "font", gc_skin_font_content,
                            "x", (double) BOARDWIDTH/2-320,
                            "y", (double)  y_start + 5,
                            "anchor", GTK_ANCHOR_NORTH_WEST,
                            "fill_color_rgba", gc_skin_color_subtitle,
                            NULL);

  // Copyright
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", "Copyright 2000-2005 Bruno Coudoin",
                            "font", gc_skin_font_content,
                            "x", (double)  BOARDWIDTH/2,
                            "y", (double)  y - 95,
                            "anchor", GTK_ANCHOR_CENTER,
                            "fill_color_rgba", gc_skin_color_content,
                            NULL);

  // License
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", _("This software is a GNU Package and is released under the GNU General Public License"),
                            "font", gc_skin_font_content,
                            "x", (double)  BOARDWIDTH/2,
                            "y", (double)  y - 80,
                            "anchor", GTK_ANCHOR_CENTER,
                            "fill_color_rgba", gc_skin_color_content,
                            NULL);

  /* Location for a potential sponsor */
  gchar *sponsor_image = gc_file_find_absolute("sponsor.png");
  if(sponsor_image)
    {
      gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                          gnome_canvas_text_get_type (),
                          "text", "Version parrainée par",
                          "font", gc_skin_font_content,
                          "x", (double)  BOARDWIDTH*0.85,
                          "y", (double)  10,
                          "anchor", GTK_ANCHOR_CENTER,
                          "fill_color_rgba", gc_skin_color_content,
                          NULL);
      gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                          gnome_canvas_text_get_type (),
                          "text", "Version parrainée par",
                          "font", gc_skin_font_content,
                          "x", (double)  BOARDWIDTH*0.85 + 1,
                          "y", (double)  10,
                          "anchor", GTK_ANCHOR_CENTER,
                          "fill_color", "black",
                          NULL);

      pixmap = gc_pixmap_load("sponsor.png");
      item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                gnome_canvas_pixbuf_get_type (),
                                "pixbuf", pixmap,
                                "x", (double) (BOARDWIDTH*0.85) - gdk_pixbuf_get_width(pixmap)/2,
                                "y", (double) 15,
                                NULL);

      gdk_pixbuf_unref(pixmap);
      g_free(sponsor_image);
    }

  // OK
  pixmap = gc_skin_pixmap_load("button_large.png");
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) BOARDWIDTH*0.5 - gdk_pixbuf_get_width(pixmap)/2,
                            "y", (double) y - gdk_pixbuf_get_height(pixmap) - 5,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_ok,
                   "ok");
  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);
  gdk_pixbuf_unref(pixmap);


  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", _("OK"),
                      "font", gc_skin_font_title,
                      "x", (double)  BOARDWIDTH*0.5 + 1.0,
                      "y", (double)  y - gdk_pixbuf_get_height(pixmap) + 20 + 1.0,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_shadow,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);
  item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_text_get_type (),
                            "text", _("OK"),
                            "font", gc_skin_font_title,
                            "x", (double)  BOARDWIDTH*0.5,
                            "y", (double)  y - gdk_pixbuf_get_height(pixmap) + 20,
                            "anchor", GTK_ANCHOR_CENTER,
                            "fill_color_rgba", gc_skin_color_text_button,
                             "weight", PANGO_WEIGHT_HEAVY,
                            NULL);
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) item_event_ok,
                   "ok");
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   item);

  pixmap_about = gc_skin_pixmap_load("gcompris-about.png");

  plane_x = gdk_pixbuf_get_width(pixmap_about)/2;
  plane_y = gdk_pixbuf_get_height(pixmap_about)/2 + 40;
  plane_speed = 1;
  plane_item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                  gnome_canvas_pixbuf_get_type (),
                                  "pixbuf", pixmap_about,
                                  "x", (double) plane_x,
                                  "y", (double) plane_y,
                                  NULL);
  move_plane_id = gtk_timeout_add (500,
                               (GtkFunction) move_plane, NULL);

  x_start += 150;
  x_flag_start = x_start + 50;
  x_text_start = x_start + 120;

  is_displayed = TRUE;

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_about_stop ( void  )

Definition at line 325 of file about.c.

{
  if (move_plane_id) {
    gtk_timeout_remove (move_plane_id);
    move_plane_id = 0;
  }

  // Destroy the help box
  if(rootitem!=NULL)
      gtk_object_destroy(GTK_OBJECT(rootitem));
  rootitem = NULL;

  if(pixmap_about)
    gdk_pixbuf_unref(pixmap_about);
  pixmap_about = NULL;

  /* UnPause the board */
  if(is_displayed)
    gc_board_pause(FALSE);

  gc_bar_hide (FALSE);

  is_displayed = FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_cache_clear ( )

Clear the cache.

All files in the cache are removed

Definition at line 165 of file cache.c.

{
#ifdef USE_GNET
  g_hash_table_foreach(hash_cache,
                     (GHFunc) _clear_cache,
                     NULL);

#endif
}
void gc_cache_end ( )

End the cache system.

Definition at line 139 of file cache.c.

{
#ifdef USE_GNET

  if(!hash_cache)
    return;

  g_hash_table_destroy (hash_cache);
  hash_cache = NULL;
#endif
}
gchar* gc_cache_get ( gchar *  url)

Get a file from the cache based on it's URL.

Definition at line 178 of file cache.c.

{
#ifdef USE_GNET
  return((char *)g_hash_table_lookup(hash_cache, url));
#else
  return NULL;
#endif
}
void gc_cache_init ( int  max_size)

cache

cache

Parameters:
max_size,:the max size in byte of the cache

Definition at line 108 of file cache.c.

{
#ifdef USE_GNET
  cache_max_size = max_size;

  /* No server defined, the cache is useless */
  if(!gc_prop_get()->server ||
     !gc_prop_get()->cache_dir)
    return;

  hash_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);

  printf("gc_cache_init\n");

  /* try to create it */
  printf("Creating cache dir %s\n", gc_prop_get()->cache_dir);
  if(g_mkdir_with_parents(gc_prop_get()->cache_dir, 0755))
    {
      g_error("Failed to create the cache directory");
    }
  printf("  opened top directory\n");
  /* Load the previous cache directory if any */
  _cache_init(gc_prop_get()->cache_dir, NULL);

  dump_cache();
#endif
}

Here is the call graph for this function:

Here is the caller graph for this function:

gchar* gc_cache_insert ( const gchar *  url,
const char *  buffer,
gssize  length 
)

Put and Get a file from the cache.

The data in 'buffer' are saved in the cache under the name 'url'. A file is created and is returned.

Parameters:
url,:the url of the data in buffer
buffer,:the data for the url
length,:length of contents, or -1 if contents is a nul-terminated string
Returns:
a full path to the file in the cache

Definition at line 196 of file cache.c.

{
#ifdef USE_GNET
  /* Save the buffer in the cache */
  if(g_file_set_contents("TBD", buffer, length, NULL))
    g_hash_table_replace(hash_cache, (gpointer) url, (gpointer) "TBD");
#endif
  return("TBD");
}
void gc_exit ( )

miscelaneous functions

Definition at line 1032 of file gcompris.c.

{
  g_signal_emit_by_name(G_OBJECT(window), "delete_event");
}

Here is the caller graph for this function:

void gc_fullscreen_set ( gboolean  state)

toggle full screen mode

Definition at line 950 of file gcompris.c.

{
#ifdef XF86_VIDMODE
  xf86_vidmode_set_fullscreen(state);
#endif
  if(state)
    {
      gdk_window_set_decorations (window->window, 0);
      gdk_window_set_functions (window->window, 0);
#ifdef XF86_VIDMODE
      if(properties->noxf86vm)
#endif
       gtk_window_fullscreen (GTK_WINDOW(window));
      gtk_widget_set_uposition (window, 0, 0);
    }
  else
    {
      /* The hide must be done at least for KDE */
      if (is_mapped)
        gtk_widget_hide (window);
      gdk_window_set_decorations (window->window, GDK_DECOR_ALL);
      if (is_mapped)
        gtk_widget_show (window);
      gdk_window_set_functions (window->window, GDK_FUNC_ALL);
#ifdef XF86_VIDMODE
      if(properties->noxf86vm)
#endif
       gtk_window_unfullscreen (GTK_WINDOW(window));
      gtk_widget_set_uposition (window, 0, 0);
    }

}

Here is the caller graph for this function:

gboolean gc_help_has_board ( GcomprisBoard *  gcomprisBoard)

Return true wether the given board has at least one help field defined.

Definition at line 72 of file help.c.

{

  prerequisite       = gcomprisBoard->prerequisite;
  goal        = gcomprisBoard->goal;
  manual      = gcomprisBoard->manual;
  credit      = gcomprisBoard->credit;
  return(prerequisite!=NULL || goal!=NULL || manual!=NULL || credit!=NULL);
}

Here is the caller graph for this function:

void gc_help_start ( GcomprisBoard *  gcomprisBoard)

These are the functions shared in the GCompris core only, not available to activity code.

The internal help API

Definition at line 86 of file help.c.

{

  GdkPixbuf   *pixmap = NULL;
  GnomeCanvasItem *item, *item2;
  gint y = 0;
  gint y_start = 0;
  gint x_start = 0;
  gchar   *name = NULL;
  gchar   *text_to_display = NULL;

  if(rootitem)
    return;

  gc_board_pause(TRUE);

  item_selected = NULL;
  item_selected_text = NULL;

  name = gcomprisBoard->title;
  gc_help_has_board(gcomprisBoard);

  rootitem = \
    gnome_canvas_item_new (gnome_canvas_root(gc_get_canvas()),
                        gnome_canvas_group_get_type (),
                        "x", (double)0,
                        "y", (double)0,
                        NULL);

  pixmap = gc_skin_pixmap_load("help_bg.png");
  y_start = (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  x_start = (BOARDWIDTH - gdk_pixbuf_get_width(pixmap))/2;
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) x_start,
                            "y", (double) y_start,
                            NULL);
  y = BOARDHEIGHT - (BOARDHEIGHT - gdk_pixbuf_get_height(pixmap))/2;
  gdk_pixbuf_unref(pixmap);

  y_start += 14;
  if(gcomprisBoard->section && gcomprisBoard->name) {
    text_to_display = g_strdup_printf("%s/%s", gcomprisBoard->section, gcomprisBoard->name);
     gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                         gnome_canvas_text_get_type (),
                         "text", text_to_display,
                         "font", gc_skin_font_board_tiny,
                         "x", (double) BOARDWIDTH*0.10 + 1.0,
                         "y", (double) y_start + 1.0,
                         "anchor", GTK_ANCHOR_NW,
                         "fill_color_rgba", gc_skin_color_shadow,
                         NULL);
     gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                         gnome_canvas_text_get_type (),
                         "text", text_to_display,
                         "font", gc_skin_font_board_tiny,
                         "x", (double) BOARDWIDTH*0.10,
                         "y", (double) y_start,
                         "anchor", GTK_ANCHOR_NW,
                         "fill_color_rgba", gc_skin_color_title,
                         NULL);
    g_free(text_to_display);
  }

  y_start += 35;
  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", name,
                      "font", gc_skin_font_title,
                      "x", (double) BOARDWIDTH/2 + 1.0,
                      "y", (double) y_start + 1.0,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_shadow,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);
  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", name,
                      "font", gc_skin_font_title,
                      "x", (double) BOARDWIDTH/2,
                      "y", (double) y_start,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_title,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);


  y_start += 120;

  pixmap = gc_skin_pixmap_load("button_up.png");

  // Prerequisite Button
  if(prerequisite)
    {
      item_prerequisite = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                           gnome_canvas_pixbuf_get_type (),
                                           "pixbuf", pixmap,
                                           "x", (double) (BOARDWIDTH*0.2) - gdk_pixbuf_get_width(pixmap)/2,
                                           "y", (double) y_start - gdk_pixbuf_get_height(pixmap) - 10,
                                           NULL);

      gtk_signal_connect(GTK_OBJECT(item_prerequisite), "event",
                      (GtkSignalFunc) item_event_help,
                      "prerequisite");

      item_prerequisite_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                gnome_canvas_text_get_type (),
                                "text", _("Prerequisite"),
                                "font", gc_skin_font_content,
                                "x", (double)  BOARDWIDTH*0.20,
                                "y", (double)  y_start - gdk_pixbuf_get_height(pixmap)  + GAP_TO_BUTTON,
                                "anchor", GTK_ANCHOR_CENTER,
                                "fill_color_rgba", gc_skin_get_color("gcompris/helpunselect"),
                                NULL);
      gtk_signal_connect(GTK_OBJECT(item_prerequisite_text), "event",
                      (GtkSignalFunc) item_event_help,
                      "prerequisite");
    }

  // Goal Button
  if(goal)
    {
      item_goal = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                    gnome_canvas_pixbuf_get_type (),
                                    "pixbuf", pixmap,
                                    "x", (double) (BOARDWIDTH*0.4) - gdk_pixbuf_get_width(pixmap)/2,
                                    "y", (double) y_start - gdk_pixbuf_get_height(pixmap) - 10,
                                    NULL);

      gtk_signal_connect(GTK_OBJECT(item_goal), "event",
                      (GtkSignalFunc) item_event_help,
                      "goal");

      item_goal_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                gnome_canvas_text_get_type (),
                                "text", _("Goal"),
                                "font", gc_skin_font_content,
                                "x", (double)  BOARDWIDTH*0.4,
                                "y", (double)  y_start - gdk_pixbuf_get_height(pixmap)  + GAP_TO_BUTTON,
                                "anchor", GTK_ANCHOR_CENTER,
                                "fill_color_rgba", gc_skin_get_color("gcompris/helpunselect"),
                                NULL);
      gtk_signal_connect(GTK_OBJECT(item_goal_text), "event",
                      (GtkSignalFunc) item_event_help,
                      "goal");
    }

  // Manual Button
  if(manual)
    {
      item_manual = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                      gnome_canvas_pixbuf_get_type (),
                                      "pixbuf", pixmap,
                                      "x", (double) (BOARDWIDTH*0.6) - gdk_pixbuf_get_width(pixmap)/2,
                                      "y", (double) y_start - gdk_pixbuf_get_height(pixmap) - 10,
                                      NULL);

      gtk_signal_connect(GTK_OBJECT(item_manual), "event",
                      (GtkSignalFunc) item_event_help,
                      "manual");

      item_manual_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                gnome_canvas_text_get_type (),
                                "text", _("Manual"),
                                "font", gc_skin_font_content,
                                "x", (double)  BOARDWIDTH*0.6,
                                "y", (double)  y_start - gdk_pixbuf_get_height(pixmap)  + GAP_TO_BUTTON,
                                "anchor", GTK_ANCHOR_CENTER,
                                "fill_color_rgba", gc_skin_get_color("gcompris/helpunselect"),
                                NULL);
      gtk_signal_connect(GTK_OBJECT(item_manual_text), "event",
                      (GtkSignalFunc) item_event_help,
                      "manual");
    }

  // Credit Button
  if(credit)
    {
      item_credit = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                      gnome_canvas_pixbuf_get_type (),
                                      "pixbuf", pixmap,
                                      "x", (double) (BOARDWIDTH*0.8) - gdk_pixbuf_get_width(pixmap)/2,
                                      "y", (double) y_start - gdk_pixbuf_get_height(pixmap) - 10,
                                      NULL);

      gtk_signal_connect(GTK_OBJECT(item_credit), "event",
                      (GtkSignalFunc) item_event_help,
                      "credit");

      item_credit_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                gnome_canvas_text_get_type (),
                                "text", _("Credit"),
                                "font", gc_skin_font_content,
                                "x", (double)  BOARDWIDTH*0.8,
                                "y", (double)  y_start - gdk_pixbuf_get_height(pixmap)  + GAP_TO_BUTTON,
                                "anchor", GTK_ANCHOR_CENTER,
                                "fill_color_rgba", gc_skin_get_color("gcompris/helpunselect"),
                                NULL);
      gtk_signal_connect(GTK_OBJECT(item_credit_text), "event",
                      (GtkSignalFunc) item_event_help,
                      "credit");
    }

  gdk_pixbuf_unref(pixmap);

  // CONTENT

  // default text to display

  if(prerequisite)
    {
      text_to_display = prerequisite;
      select_item(item_prerequisite, item_prerequisite_text);
    }
  else if(goal)
    {
      text_to_display = goal;
      select_item(item_goal, item_goal_text);
    }
  else if(manual)
    {
      text_to_display = manual;
      select_item(item_manual, item_manual_text);
    }
  else if(credit)
    {
      text_to_display = credit;
      select_item(item_credit, item_credit_text);
    }

  y_start += 5;

  /* Create a scrolled area for the text content */
  GtkWidget *view;
  GtkWidget *sw;
  view = gtk_text_view_new ();
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
  gtk_text_view_set_editable(GTK_TEXT_VIEW (view), FALSE);
  gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW (view), FALSE);

  PangoFontDescription *font_desc;
  font_desc = pango_font_description_from_string (gc_skin_font_content);
  gtk_widget_modify_font (view, font_desc);
  pango_font_description_free (font_desc);

  GdkColor fg_color;
  GdkColor bg_color;
  gc_skin_get_gdkcolor("gcompris/helpfg", &fg_color);
  gc_skin_get_gdkcolor("gcompris/helpbg", &bg_color);
  gtk_widget_modify_base(view, GTK_STATE_NORMAL, &bg_color);
  gtk_widget_modify_text(view, GTK_STATE_NORMAL, &fg_color);

  buffer_content = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
  sw = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
                              GTK_POLICY_AUTOMATIC,
                              GTK_POLICY_AUTOMATIC);
  gtk_container_add (GTK_CONTAINER (sw), view);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_widget_get_type (),
                      "widget", GTK_WIDGET(sw),
                      "x", (double)  x_start + 40,
                      "y", (double)  y_start,
                      "width",  618.0,
                      "height", 280.0,
                      NULL);
  gtk_widget_show_all (sw);

  set_content(text_to_display);
  // OK
  pixmap = gc_skin_pixmap_load("button_large.png");

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) (BOARDWIDTH*0.5) - gdk_pixbuf_get_width(pixmap)/2,
                            "y", (double) y - gdk_pixbuf_get_height(pixmap) - 5,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_help,
                   "ok");
  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   NULL);

  gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                      gnome_canvas_text_get_type (),
                      "text", _("OK"),
                      "font", gc_skin_font_title,
                      "x", (double)  BOARDWIDTH*0.5 + 1.0,
                      "y", (double)  y - gdk_pixbuf_get_height(pixmap) + 20 + 1.0,
                      "anchor", GTK_ANCHOR_CENTER,
                      "fill_color_rgba", gc_skin_color_shadow,
                      "weight", PANGO_WEIGHT_HEAVY,
                      NULL);
  item2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                             gnome_canvas_text_get_type (),
                             "text", _("OK"),
                             "font", gc_skin_font_title,
                             "x", (double)  BOARDWIDTH*0.5,
                             "y", (double)  y - gdk_pixbuf_get_height(pixmap) + 20,
                             "anchor", GTK_ANCHOR_CENTER,
                             "fill_color_rgba", gc_skin_color_text_button,
                             "weight", PANGO_WEIGHT_HEAVY,
                            NULL);
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) item_event_help,
                   "ok");
  gtk_signal_connect(GTK_OBJECT(item2), "event",
                   (GtkSignalFunc) gc_item_focus_event,
                   item);
  gdk_pixbuf_unref(pixmap);

  gc_bar_hide(TRUE);

  help_displayed = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_help_stop ( )

Definition at line 411 of file help.c.

{
  if(help_displayed)
    {
      // Destroy the help box
      if(rootitem!=NULL)
       {
         gtk_object_destroy(GTK_OBJECT(rootitem));
         rootitem = NULL;
       }
      gc_board_pause(FALSE);
    }

  gc_bar_hide(FALSE);
  help_displayed = FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_log_set_key ( GcomprisBoard *  gcomprisBoard,
guint  keyval 
)

gc_log_key

Parameters:
GcomprisBoard*gcomprisBoard: the board for which the event happen
key,:a keyval as defined by gtk

Definition at line 111 of file log.c.

                                                                 {
  char utf8char[6];
  int i;
  /* get the current time from the Unix kernel */
  time_t end_time = time(NULL);
  double duration = difftime(end_time,start_time_key);

  if(!g_unichar_isalnum (gdk_keyval_to_unicode (keyval)))
    return;

  /* Reset the timer */
  start_time_key = end_time;

  /* Should be an easier way to get the UTF-8 code in our string */
  for(i=0; i<6; i++)
    utf8char[i] = '\0';

  sprintf(utf8char, "%c", gdk_keyval_to_unicode(keyval));

  g_unichar_to_utf8 (gdk_keyval_to_unicode(keyval),
                   utf8char);

  if(strlen(keylog)<(KEYLOG_MAX-10)) {
    strcat(keylog, utf8char);
    printf(" 1 gc_log_set_key %s\n", keylog);
    sprintf(keylog+strlen(keylog), "/%d:", (guint)duration);
    printf(" 2 gc_log_set_key %s\n", keylog);
  }

}
void gc_log_start ( GcomprisBoard *  gcomprisBoard)

log

log

Parameters:
GcomprisBoard*gcomprisBoard: the board for which the event happen

Definition at line 63 of file log.c.

                                                 {

  gcomprisBoard_set = gcomprisBoard;
  start_time     = time(NULL);
  start_time_key = time(NULL);

#ifndef WIN32
  gethostname(hostname, 256);
#endif

  comment_set = "";
  keylog[0]   = '\0';
}

Here is the caller graph for this function:

void gc_menu_destroy ( void  )

Definition at line 691 of file menu.c.

{
    GList * list;
    for(list = boards_list ; list ; list = list -> next)
    {
        gc_menu_board_free((GcomprisBoard *) list->data);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_menu_load ( )

menu

Definition at line 604 of file menu.c.

{
  GcomprisProperties *properties = gc_prop_get();

  if(boards_list)
    {
      cleanup_menus();
      return;
    }

  if ((!properties->reread_menu) && gc_db_check_boards())
    {
      boards_list = gc_menu_load_db(boards_list);

      if (!properties->administration)
       {
         GList *out_boards = NULL;
         GList *list = NULL;
         GcomprisBoard *board;

         for (list = boards_list; list != NULL; list = list->next)
           {
             board = (GcomprisBoard *)list->data;
             if (g_list_find_custom(gc_profile_get_current()->activities,
                                 &(board->board_id), compare_id))
              out_boards = g_list_append(out_boards, board);
           }
         for (list = out_boards; list != NULL; list = list->next)
           boards_list = g_list_remove(boards_list, list->data);
       }
    }
  else
    {
      int db = (gc_profile_get_current() ? TRUE: FALSE);
      properties->reread_menu = TRUE;
      gc_menu_load_dir(properties->package_data_dir, db);
      GDate *today = g_date_new();
      g_date_set_time (today, time (NULL));

      gchar date[11];
      g_date_strftime (date, 11, "%F", today);
      gc_db_set_date(date);
      gc_db_set_version(VERSION);
      g_date_free(today);
    }


  if (properties->local_directory){
    gchar *board_dir = g_strdup_printf("%s/boards/", properties->local_directory);
    gc_menu_load_dir(board_dir, FALSE);
    g_free(board_dir);
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

mimetype

mimetype

Must be called once at GCompris startup.

Definition at line 916 of file file_selector.c.

{
  const gchar  *one_dirent;
  GcomprisProperties *properties = gc_prop_get();
  GDir   *dir;
  gchar  *mime_dir;

  if(mimetypes_hash) {
    return;
  }

  mime_dir = g_strconcat(properties->package_data_dir, "/gcompris/mimetypes/", NULL);

  mimetypes_hash      = g_hash_table_new (g_str_hash, g_str_equal);
  mimetypes_ext_hash  = g_hash_table_new (g_str_hash, g_str_equal);
  mimetypes_desc_hash = g_hash_table_new (g_str_hash, g_str_equal);

  /* Load the Pixpmaps directory file names */
  dir = g_dir_open(mime_dir, 0, NULL);

  if (!dir) {
    g_warning("gc_mime_type_load : no mime types found in %s", mime_dir);
  } else {

    while((one_dirent = g_dir_read_name(dir)) != NULL) {
      /* add the board to the list */
      gchar *filename;

      filename = g_strdup_printf("%s/%s", mime_dir, one_dirent);

      if(!g_file_test(filename, G_FILE_TEST_IS_REGULAR)) {
       g_free(filename);
       continue;
      }

      if(file_end_with_xml(one_dirent)) {
       load_mime_type_from_file(filename);
      }
      g_free(filename);
    }
  }
  g_free(mime_dir);
  g_dir_close(dir);
}

Here is the call graph for this function:

Here is the caller graph for this function: