Back to index

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

Go to the source code of this file.

Classes

struct  BoardPluginData

Defines

#define GET_BPLUGIN_INFO(pluginname)
 Handles plugins initialization.

Functions

void gc_board_init (void)
BoardPlugingc_board_get_current_board_plugin (void)
GcomprisBoard * gc_board_get_current (void)
void gc_board_set_current (GcomprisBoard *gcomprisBoard)
gboolean gc_board_check_file (GcomprisBoard *gcomprisBoard)
void gc_board_play (GcomprisBoard *gcomprisBoard)
void gc_board_stop (void)
void gc_board_pause (int pause)
void gc_board_run_next (GcomprisBoard *board)

Class Documentation

struct BoardPluginData

Definition at line 45 of file board.h.

Class Members
GcomprisBoard * current_gcompris_board
gboolean playing

Define Documentation

#define GET_BPLUGIN_INFO (   pluginname)
Value:
BoardPlugin                      \
  *get_bplugin_info(void) \
  { \
    return &menu_bp; \
  }

Handles plugins initialization.

WIN32 = Static module, else it's dynamic

Definition at line 37 of file board.h.


Function Documentation

gboolean gc_board_check_file ( GcomprisBoard *  gcomprisBoard)

Definition at line 270 of file board.c.

{
  GModule     *gmodule = NULL;
  gchar       *gmodule_file = NULL;
  BoardPlugin *(*plugin_get_bplugin_info) (void) = NULL;
  GcomprisProperties *properties = gc_prop_get();
  gchar *sep;
  gchar *type;

  g_assert(gcomprisBoard!=NULL);

  /* Check Already loaded */
  if(gcomprisBoard->plugin!=NULL) {
    return TRUE;
  }

  type = g_strdup(gcomprisBoard->type);

  /* Manage the python case where : is use to separate python plugin and boards */
  if((sep = strchr(type, ':')))
    *sep ='\0';

  gmodule_file = g_module_build_path (properties->package_plugin_dir, type);

  gmodule = g_module_open (gmodule_file, 0);
  if(gmodule) {
    g_warning("opened module %s with name %s\n", gmodule_file, type);
  } else {
    g_warning("Failed to open module %s with name %s (error=%s)\n", gmodule_file,
             type, g_module_error());
  }
  g_free(type);

  if(gmodule != NULL) {

    g_module_symbol (gmodule, "get_bplugin_info", (gpointer) &plugin_get_bplugin_info);

    if(plugin_get_bplugin_info != NULL) {

      BoardPlugin *bp;

      /* Get the BoardPlugin Info */
      bp = (BoardPlugin *) plugin_get_bplugin_info();

      /* If this plugin defines an initialisation entry point, call it */
      if(bp->init != NULL) {
       bp->init(gcomprisBoard);
      }

      if(bp->is_our_board(gcomprisBoard)) {
       /* Great, we found our plugin */
       g_warning("We found the correct plugin for board %s (type=%s)\n", gcomprisBoard->name, gcomprisBoard->type);

       /* done in is_our_board gcomprisBoard->plugin = bp; */

       /* Save this for caching and cleanup */
       gcomprisBoard->gmodule_file = gmodule_file;
       gcomprisBoard->gmodule      = gmodule;

       return TRUE;
      } else {
       g_warning("We found a plugin with the name %s but is_our_board() returned FALSE (type=%s)\n",
                gcomprisBoard->name,
                gcomprisBoard->type);
      }
    } else {
      g_warning("plugin_get_bplugin_info entry point not found for %s\n",
              gcomprisBoard->filename);
    }
  }
  g_warning("No plugin library found for board type '%s', requested by '%s'",
           gcomprisBoard->type,  gcomprisBoard->filename);

  return FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

GcomprisBoard* gc_board_get_current ( void  )

Definition at line 196 of file board.c.

Here is the caller graph for this function:

Definition at line 188 of file board.c.

{
  if(bp_data->current_gcompris_board)
    return bp_data->current_gcompris_board->plugin;

  return NULL;
}

Here is the caller graph for this function:

void gc_board_init ( void  )

Definition at line 176 of file board.c.

{

  /* First make sure the module loading is supported on this platform */
  if (!g_module_supported())
    g_error( _("Dynamic module loading is not supported. gcompris cannot load.\n") );

  bp_data = g_malloc0(sizeof (struct BoardPluginData));

}

Here is the caller graph for this function:

void gc_board_pause ( int  pause)

Definition at line 376 of file board.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_board_play ( GcomprisBoard *  gcomprisBoard)

Definition at line 348 of file board.c.

{
  BoardPlugin *bp;

  g_assert(gcomprisBoard!=NULL);

  gc_board_check_file(gcomprisBoard);

  if(gcomprisBoard->plugin!=NULL)
    {
      /* Log the board start */
      gc_log_start(gcomprisBoard);

      bp = gcomprisBoard->plugin;
      gc_board_set_current(gcomprisBoard);

      bp->start_board(gcomprisBoard);
      bp_data->playing = TRUE;

      return;
    }

  /* We set the playing flag even if no boardplugin
     recognizes the board. This way we are sure it will be skipped. */
  bp_data->playing = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_board_run_next ( GcomprisBoard *  board)

Definition at line 429 of file board.c.

{
  board->previous_board = gc_board_get_current();

  next_board = board;

  next_board_callback_id = gtk_timeout_add (NEXT_TIME_DELAY,
                                       (GtkFunction) board_run_next_end,
                                       NULL);

}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_board_set_current ( GcomprisBoard *  gcomprisBoard)

Definition at line 201 of file board.c.

Here is the caller graph for this function:

void gc_board_stop ( void  )

Definition at line 386 of file board.c.

Here is the call graph for this function:

Here is the caller graph for this function: