/**
 * games_runtime_init:
 *
 * Initialises the runtime file localisator. This also calls setlocale,
 * and initialises gettext support and gnome-games debug support.
 *
 * NOTE: This must be called before using ANY other glib/gtk/etc function!
 * 
 * Returns: %TRUE iff initialisation succeeded
 */
gboolean
games_runtime_init (const char *name)
{
  gboolean retval;

  setlocale (LC_ALL, "");

#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS) || defined(HAVE_GSTREAMER)
  /* If we're going to use gconf, gnome-vfs, or gstreamer, we need to
   * init threads before calling any glib functions.
   */
  g_thread_init (NULL);
  /* May call any glib function after this point */
#endif

  _games_profile_start ("games_runtime_init");

  _games_debug_init ();

  app_name = g_strdup (name);

  bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
  textdomain(GETTEXT_PACKAGE);

#ifdef G_OS_WIN32
{
  const char *path;

  path = games_runtime_get_directory (GAMES_RUNTIME_MODULE_DIRECTORY);

  _games_debug_print (GAMES_DEBUG_RUNTIME,
                      "Relocation path: %s\n", path ? path : "(null)");

  retval = path != NULL;
}
#else
  retval = TRUE;
#endif

#if defined(ENABLE_CARD_THEME_FORMAT_KDE) || defined(ENABLE_CARD_THEME_FORMAT_SLICED) || defined(ENABLE_CARD_THEME_FORMAT_PYSOL)
  if (strcmp (app_name, "aisleriot") == 0 || strcmp (app_name, "blackjack") == 0) {
    gpl_version = 3;
  } else
#endif
  gpl_version = 2;

  _games_profile_end ("games_runtime_init");

  return retval;
}
static gboolean
ar_card_theme_sliced_prerender_scalable (ArCardThemeSliced *theme)
{
  ArCardThemePreimage *preimage_card_theme = (ArCardThemePreimage *) theme;

  g_assert (theme->source == NULL);

  _games_profile_start ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((ArCardTheme*)theme)->theme_info->display_name);

  theme->source = games_preimage_render (preimage_card_theme->cards_preimage,
                                         preimage_card_theme->card_size.width * 13,
                                         preimage_card_theme->card_size.height * 5);

  _games_profile_end ("prerendering source pixbuf for %s card theme %s", G_OBJECT_TYPE_NAME (theme), ((ArCardTheme*)theme)->theme_info->display_name);

  if (!theme->source)
    return FALSE;

  theme->subsize.width = gdk_pixbuf_get_width (theme->source) / 13;
  theme->subsize.height = gdk_pixbuf_get_height (theme->source) / 5;

  return TRUE;
}