Back to index

gcompris  8.2.2
Defines | Functions | Variables
config.c File Reference
#include <string.h>
#include "gcompris.h"
#include "gc_core.h"
#include "gcompris_config.h"
#include "locale.h"

Go to the source code of this file.

Defines

#define Y_GAP   45
#define SOUNDLISTFILE   PACKAGE

Functions

static void set_locale_flag (gchar *locale)
static gchar * get_next_locale (gchar *locale)
 Given the short locale name, return the next one in our linguas table.
static gchar * get_previous_locale (gchar *locale)
 Given the short locale name, return the previous one in our linguas table.
static gint item_event_ok (GnomeCanvasItem *item, GdkEvent *event, gpointer data)
static void display_previous_next (guint x_start, guint y_start, gchar *eventname_previous, gchar *eventname_next)
void gc_config_start ()
void gc_config_stop ()
gchar * gc_locale_get_name (gchar *locale)
 Given the locale name, return the full translated name If not found, simply return the name.

Variables

static GnomeCanvasItem * rootitem = NULL
 Configuration of gcompris.
static GnomeCanvasItem * item_locale_text = NULL
static GnomeCanvasItem * item_locale_flag = NULL
static GnomeCanvasItem * item_bad_flag = NULL
static GnomeCanvasItem * item_screen_text = NULL
static GnomeCanvasItem * item_timer_text = NULL
static GnomeCanvasItem * item_skin_text = NULL
static GnomeCanvasItem * item_filter_text = NULL
static GdkPixbuf * pixmap_checked = NULL
static GdkPixbuf * pixmap_unchecked = NULL
static gchar * current_locale = NULL
static GList * skinlist = NULL
static guint skin_index
static GnomeCanvasGroup * stars_group = NULL
static double stars_group_x
static double stars_group_y
static gboolean is_displayed = FALSE
static gchar * linguas []
static gchar * timername []
static gchar * screenname []
static gchar * filtername []

Define Documentation

#define SOUNDLISTFILE   PACKAGE

Definition at line 56 of file config.c.

#define Y_GAP   45

Definition at line 52 of file config.c.


Function Documentation

static void display_previous_next ( guint  x_start,
guint  y_start,
gchar *  eventname_previous,
gchar *  eventname_next 
) [static]

Definition at line 555 of file config.c.

{
  GdkPixbuf   *pixmap = NULL;
  GnomeCanvasItem *item;

  pixmap = gc_skin_pixmap_load("button_backward.png");
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) x_start - gdk_pixbuf_get_width(pixmap) - 10,
                            "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                            NULL);

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


  pixmap = gc_skin_pixmap_load("button_forward.png");
  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", pixmap,
                            "x", (double) x_start,
                            "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                            NULL);

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

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_config_start ( )

Definition at line 145 of file config.c.

{
  GcomprisProperties *properties = gc_prop_get();
  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;

  /* 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", _("GCompris Configuration"),
                      "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", _("GCompris Configuration"),
                      "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);

  pixmap_checked   = gc_skin_pixmap_load("button_checked.png");
  pixmap_unchecked = gc_skin_pixmap_load("button_unchecked.png");


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

  //--------------------------------------------------
  // Locale
  y_start += 105;

  display_previous_next(x_start, y_start, "locale_previous", "locale_next");

  item_locale_flag = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                       gnome_canvas_pixbuf_get_type (),
                                       "pixbuf", NULL,
                                       "x", (double) x_flag_start,
                                       "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                                       NULL);

  /* Display a bad icon if this locale is not available */
  pixmap   = gc_skin_pixmap_load("mini_bad.png");
  item_bad_flag = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                    gnome_canvas_pixbuf_get_type (),
                                    "pixbuf", pixmap,
                                    "x", (double) x_flag_start - 20,
                                    "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                                    NULL);
  gdk_pixbuf_unref(pixmap);

  /*
   * The current locale is the one found in the config file
   */
  current_locale = properties->locale;
  set_locale_flag(current_locale);

  item_locale_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                       gnome_canvas_text_get_type (),
                                       "text", gc_locale_get_name(current_locale),
                                       "font", gc_skin_font_subtitle,
                                       "x", (double) x_text_start,
                                       "y", (double) y_start,
                                       "anchor", GTK_ANCHOR_WEST,
                                       "fill_color_rgba", gc_skin_color_content,
                                       NULL);

  // Fullscreen / Window
  y_start += Y_GAP;

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", (properties->fullscreen ? pixmap_checked : pixmap_unchecked),
                            "x", (double) x_start,
                            "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_ok,
                   "fullscreen");
  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", _("Fullscreen"),
                      "font", gc_skin_font_subtitle,
                      "x", (double) x_text_start,
                      "y", (double) y_start,
                      "anchor", GTK_ANCHOR_WEST,
                      "fill_color_rgba", gc_skin_color_content,
                      NULL);

  // Screen size
  y_start += Y_GAP;

  display_previous_next(x_start, y_start, "screen_previous", "screen_next");

  item_screen_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                       gnome_canvas_text_get_type (),
                                       "text", gettext(screenname[properties->screensize]),
                                       "font", gc_skin_font_subtitle,
                                       "x", (double) x_text_start,
                                       "y", (double) y_start,
                                       "anchor", GTK_ANCHOR_WEST,
                                       "fill_color_rgba", gc_skin_color_content,
                                       NULL);

  // Music
  y_start += Y_GAP;

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", (properties->music ? pixmap_checked : pixmap_unchecked),
                            "x", (double) x_start,
                            "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_ok,
                   "music");
  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", _("Music"),
                      "font", gc_skin_font_subtitle,
                      "x", (double) x_text_start,
                      "y", (double) y_start,
                      "anchor", GTK_ANCHOR_WEST,
                      "fill_color_rgba", gc_skin_color_content,
                      NULL);

  // Effect
  y_start += Y_GAP;

  item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                            gnome_canvas_pixbuf_get_type (),
                            "pixbuf", (properties->fx ? pixmap_checked : pixmap_unchecked),
                            "x", (double) x_start,
                            "y", (double) y_start - gdk_pixbuf_get_width(pixmap_checked)/2,
                            NULL);

  gtk_signal_connect(GTK_OBJECT(item), "event",
                   (GtkSignalFunc) item_event_ok,
                   "effect");
  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", _("Effect"),
                      "font", gc_skin_font_subtitle,
                      "x", (double) x_text_start,
                      "y", (double) y_start,
                      "anchor", GTK_ANCHOR_WEST,
                      "fill_color_rgba", gc_skin_color_content,
                      NULL);

  // Timer
  y_start += Y_GAP;

  display_previous_next(x_start, y_start, "timer_previous", "timer_next");

  item_timer_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                      gnome_canvas_text_get_type (),
                                      "text", gettext(timername[properties->timer]),
                                      "font", gc_skin_font_subtitle,
                                      "x", (double) x_text_start,
                                      "y", (double) y_start,
                                      "anchor", GTK_ANCHOR_WEST,
                                      "fill_color_rgba", gc_skin_color_content,
                                      NULL);

  // Skin
  {
    const gchar *one_dirent;
    guint  i;
    GDir  *dir;
    gchar *skin_dir;
    gchar *first_skin_name;

    /* Load the Pixpmaps directory file names */
    skin_dir = g_strconcat(properties->package_data_dir, "/skins", NULL);
    dir = g_dir_open(skin_dir, 0, NULL);

    if (!dir)
      g_warning (_("Couldn't open skin dir: %s"), skin_dir);

    /* Fill up the skin list */
    while((one_dirent = g_dir_read_name(dir)) != NULL) {

      if (one_dirent[0] != '.') {
       gchar *filename;
       /* Only directory here are skins */
       filename = g_strdup_printf("%s/skins/%s", properties->package_data_dir, one_dirent);

       if (g_file_test ((filename), G_FILE_TEST_IS_DIR)) {
         gchar *skin_name = g_strdup_printf("%s", one_dirent);
         skinlist = g_list_append (skinlist, skin_name);
       }
       g_free(filename);
      }
    }
    g_dir_close(dir);

    /* Find the current skin index */
    skin_index = 0;
    for(i=0; i<g_list_length(skinlist);  i++)
      if(!strcmp((char *)g_list_nth_data(skinlist, i), properties->skin))
       skin_index = i;

    y_start += Y_GAP;

    /* Should not happen. It the user found the config, there should be a skin */
    if(g_list_length(skinlist) > 0) {
      g_warning("No skin found in %s\n", skin_dir);
      display_previous_next(x_start, y_start, "skin_previous", "skin_next");
      first_skin_name = g_strdup_printf(_("Skin : %s"), (char *)g_list_nth_data(skinlist, skin_index));
    } else {
      first_skin_name = g_strdup(_("SKINS NOT FOUND"));
    }

    item_skin_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                       gnome_canvas_text_get_type (),
                                       "text", first_skin_name,
                                       "font", gc_skin_font_subtitle,
                                       "x", (double) x_text_start,
                                       "y", (double) y_start,
                                       "anchor", GTK_ANCHOR_WEST,
                                       "fill_color_rgba", gc_skin_color_content,
                                       NULL);
    g_free(first_skin_name);
    g_free(skin_dir);

  }

  // Difficulty Filter
  y_start += Y_GAP;

  //  display_previous_next(x_start, y_start, "filter_style_previous", "filter_style_next");

  stars_group_x = x_start + 45;
  stars_group_y = y_start - 25;

  item_filter_text = gnome_canvas_item_new (GNOME_CANVAS_GROUP(rootitem),
                                       gnome_canvas_text_get_type (),
                                       "markup", gettext(filtername[0]),
                                       "font", gc_skin_font_subtitle,
                                       "x", (double) x_text_start,
                                       "y", (double) y_start,
                                       "anchor", GTK_ANCHOR_WEST,
                                       "fill_color_rgba", gc_skin_color_content,
                                       NULL);


  // 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);

  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);
  gdk_pixbuf_unref(pixmap);


  is_displayed = TRUE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void gc_config_stop ( )

Definition at line 495 of file config.c.

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

  stars_group = NULL;

  if(pixmap_unchecked)
    gdk_pixbuf_unref(pixmap_unchecked);
  pixmap_unchecked = NULL;

  if(pixmap_checked)
    gdk_pixbuf_unref(pixmap_checked);
  pixmap_checked = 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:

gchar* gc_locale_get_name ( gchar *  locale)

Given the locale name, return the full translated name If not found, simply return the name.

Definition at line 530 of file config.c.

{
  guint i = 0;

  /* en (US) is not in the Linguas table */
  if(locale[0] != '\0' && !strncmp(locale, "en", strlen(locale)))
    return(_("English (United State)"));

  while(linguas[i] != NULL)
    {

      if(!strncmp(locale, linguas[i], strlen(locale)))
       return(gettext(linguas[i+1]));

      i=i+2;
    }
  // Oups this locale is not in the table. Return the first one (system default)
  return(linguas[1]);
}

Here is the caller graph for this function:

static gchar * get_next_locale ( gchar *  locale) [static]

Given the short locale name, return the next one in our linguas table.

Definition at line 655 of file config.c.

{
  guint i = 0;

  while(linguas[i] != NULL)
    {
      if(!strcmp(locale, linguas[i]))
       {
         // Found it
         if(linguas[i+2]!=NULL)
           return(linguas[i+2]);
         else
           return(linguas[0]);

       }
      i=i+2;
    }
  // Oups this locale is not in the table. Return the first one
  return(linguas[0]);
}

Here is the caller graph for this function:

static gchar * get_previous_locale ( gchar *  locale) [static]

Given the short locale name, return the previous one in our linguas table.

Definition at line 680 of file config.c.

{
  guint i = 0;

  while(linguas[i] != NULL)
    {
      if(!strcmp(locale, linguas[i]))
       {
         // Found it
         if(i!=0)
           return(linguas[i-2]);
         else
           {
             // Go to the end of the list
             while(linguas[i]!=NULL) { i=i+2; };
             return(linguas[i-2]);
           }
       }
      i=i+2;
    }
  return(locale);
}

Here is the caller graph for this function:

static gint item_event_ok ( GnomeCanvasItem *  item,
GdkEvent *  event,
gpointer  data 
) [static]

Definition at line 705 of file config.c.

{
  GcomprisProperties *properties = gc_prop_get();

  if(data==NULL)
    return FALSE;

  switch (event->type)
    {
    case GDK_ENTER_NOTIFY:
      break;
    case GDK_LEAVE_NOTIFY:
      break;
    case GDK_BUTTON_PRESS:
      if(!strcmp((char *)data, "ok"))
       {
         /* Set the new locale in the properties */
         if (properties->locale != current_locale)
           {
             g_free(properties->locale);
             properties->locale = strdup(current_locale);
           }

         if(current_locale[0] == '\0') {
           /* Set the locale to the default user's locale */
           gc_locale_set(gc_locale_get_user_default());
         } else {
           gc_locale_set(current_locale);
         }
         g_free(properties->skin);
         properties->skin = g_strdup((char *)g_list_nth_data(skinlist, skin_index));
         gc_skin_load(properties->skin);
         gc_config_stop();

         if(properties->music || properties->fx)
           gc_sound_init();

         if(!properties->music && !properties->fx)
           gc_sound_close();
         else
           {
             if(!properties->music)
              sdlplayer_halt_music();
             else
              sdlplayer_resume_music();

             if(!properties->fx)
              sdlplayer_halt_fx();
             else
              sdlplayer_resume_fx();
           }
         gc_prop_save(properties);
       }
      else if(!strcmp((char *)data, "fullscreen"))
       {
         properties->fullscreen = (properties->fullscreen ? 0 : 1);

#ifdef XF86_VIDMODE
         /* Changing screen without xrandr is more complex, it requires to remove the
            black border we created manually.
         */
         if(!properties->noxf86vm)
           gc_fullscreen_set(properties->fullscreen);
#endif
         /* Warning changing the image needs to update pixbuf_ref for the focus usage */
         gc_item_focus_free(item, NULL);
         gnome_canvas_item_set (item,
                             "pixbuf", (properties->fullscreen ? pixmap_checked : pixmap_unchecked),
                             NULL);

       }
      else if(!strcmp((char *)data, "music"))
       {
         properties->music = (properties->music ? 0 : 1);
         /* Warning changing the image needs to update pixbuf_ref for the focus usage */
         gc_item_focus_free(item, NULL);
         gnome_canvas_item_set (item,
                             "pixbuf", (properties->music ? pixmap_checked : pixmap_unchecked),
                             NULL);
         if(!properties->music)
           {
             sdlplayer_halt_music();
           }
         else
           {
             gc_sound_init();
             sdlplayer_resume_music();
           }
       }
      else if(!strcmp((char *)data, "effect"))
       {
         properties->fx = (properties->fx ? 0 : 1);
         /* Warning changing the image needs to update pixbuf_ref for the focus usage */
         gc_item_focus_free(item, NULL);
         gnome_canvas_item_set (item,
                             "pixbuf", (properties->fx ? pixmap_checked : pixmap_unchecked),
                             NULL);


       }
      else if(!strcmp((char *)data, "locale_previous"))
       {
         current_locale = get_previous_locale(current_locale);
         gnome_canvas_item_set (item_locale_text,
                             "text", gc_locale_get_name(current_locale),
                             NULL);
         set_locale_flag(current_locale);
       }
      else if(!strcmp((char *)data, "locale_next"))
       {
         current_locale = get_next_locale(current_locale);
         gnome_canvas_item_set (item_locale_text,
                             "text", gc_locale_get_name(current_locale),
                             NULL);

         set_locale_flag(current_locale);
       }
      else if(!strcmp((char *)data, "screen_previous"))
       {
         if(properties->screensize>0)
           properties->screensize--;

         gnome_canvas_item_set (item_screen_text,
                             "text", gettext(screenname[properties->screensize]),
                             NULL);
       }
      else if(!strcmp((char *)data, "screen_next"))
       {
         if(properties->screensize<MAX_SCREEN_VALUE)
           properties->screensize++;

         gnome_canvas_item_set (item_screen_text,
                             "text", gettext(screenname[properties->screensize]),
                             NULL);
       }
      else if(!strcmp((char *)data, "timer_previous"))
       {
         if(properties->timer>0)
           properties->timer--;

         gnome_canvas_item_set (item_timer_text,
                             "text", gettext(timername[properties->timer]),
                             NULL);
       }
      else if(!strcmp((char *)data, "timer_next"))
       {
         if(properties->timer<MAX_TIMER_VALUE)
           properties->timer++;

         gnome_canvas_item_set (item_timer_text,
                             "text", gettext(timername[properties->timer]),
                             NULL);
       }
      else if(!strcmp((char *)data, "skin_previous"))
       {
         gchar *skin_str;
         if(skin_index-- < 1)
           skin_index = g_list_length(skinlist)-1;

         skin_str = g_strdup_printf(_("Skin : %s"),
                                 (char *)g_list_nth_data(skinlist, skin_index));

         gnome_canvas_item_set (item_skin_text,
                             "text", skin_str,
                             NULL);
         g_free(skin_str);
       }
      else if(!strcmp((char *)data, "skin_next"))
       {
         gchar *skin_str;
         if(skin_index++ >= g_list_length(skinlist)-1)
           skin_index = 0;

         skin_str = g_strdup_printf(_("Skin : %s"),
                                 (char *)g_list_nth_data(skinlist, skin_index));
         gnome_canvas_item_set (item_skin_text,
                             "text", skin_str,
                             NULL);
         g_free(skin_str);
       }
    default:
      break;
    }
  return FALSE;

}

Here is the call graph for this function:

Here is the caller graph for this function:

static void set_locale_flag ( gchar *  locale) [static]

Definition at line 596 of file config.c.

{
  gchar *filename;
  GdkPixbuf *pixmap = NULL;

  if(locale == NULL)
    return;

  if(locale[0] == '\0') {
    /* Set the flag to the default user's locale */
    locale = gc_locale_get_user_default();
    g_message("gc_locale_get_user_default = %s\n", locale);
  }

  /* First try to find a flag for the long locale name */
  filename = gc_file_find_absolute("flags/%.5s.png", locale);

  /* Not found, Try now with the short locale name */
  if(!filename) {
    filename = gc_file_find_absolute("flags/%.2s.png", locale);
  }

  if(filename)
    {
      pixmap = gc_net_load_pixmap(filename);

      gnome_canvas_item_set (item_locale_flag,
                          "pixbuf", pixmap,
                          NULL);

      gdk_pixbuf_unref(pixmap);
      g_free(filename);
    }
  else
    {
      /* No flags */
      gnome_canvas_item_set (item_locale_flag,
                          "pixbuf", NULL,
                          NULL);
    }

  /* Check wether or not the locale is available */
#ifdef WIN32
  /* On win32, it's always available, do not try to check */
  gnome_canvas_item_hide (item_bad_flag);
#else
  if(setlocale(LC_MESSAGES, locale)==NULL)
    gnome_canvas_item_show (item_bad_flag);
  else
    gnome_canvas_item_hide (item_bad_flag);
#endif

}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

gchar* current_locale = NULL [static]

Definition at line 44 of file config.c.

gchar* filtername[] [static]
Initial value:
 {

}

Definition at line 129 of file config.c.

gboolean is_displayed = FALSE [static]

Definition at line 54 of file config.c.

GnomeCanvasItem* item_bad_flag = NULL [static]

Definition at line 36 of file config.c.

GnomeCanvasItem* item_filter_text = NULL [static]

Definition at line 40 of file config.c.

GnomeCanvasItem* item_locale_flag = NULL [static]

Definition at line 35 of file config.c.

GnomeCanvasItem* item_locale_text = NULL [static]

Definition at line 34 of file config.c.

GnomeCanvasItem* item_screen_text = NULL [static]

Definition at line 37 of file config.c.

GnomeCanvasItem* item_skin_text = NULL [static]

Definition at line 39 of file config.c.

GnomeCanvasItem* item_timer_text = NULL [static]

Definition at line 38 of file config.c.

gchar* linguas[] [static]

Definition at line 58 of file config.c.

GdkPixbuf* pixmap_checked = NULL [static]

Definition at line 41 of file config.c.

GdkPixbuf* pixmap_unchecked = NULL [static]

Definition at line 42 of file config.c.

GnomeCanvasItem* rootitem = NULL [static]

Configuration of gcompris.

Definition at line 33 of file config.c.

gchar* screenname[] [static]
Initial value:
 {
  "640x480",
  N_("800x600 (Default for gcompris)"),
  "1024x768",
}

Definition at line 123 of file config.c.

guint skin_index [static]

Definition at line 46 of file config.c.

GList* skinlist = NULL [static]

Definition at line 45 of file config.c.

GnomeCanvasGroup* stars_group = NULL [static]

Definition at line 48 of file config.c.

double stars_group_x [static]

Definition at line 49 of file config.c.

double stars_group_y [static]

Definition at line 50 of file config.c.

gchar* timername[] [static]
Initial value:
 {
  N_("No time limit"),
  N_("Slow timer"),
  N_("Normal timer"),

}

Definition at line 116 of file config.c.