gnome-games r8470 - in trunk: aisleriot blackjack/src glines gnect/src gnibbles gnobots2 gnometris gnomine gnotravex gnotski gtali iagno libgames-support mahjongg same-gnome
- From: chpe svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r8470 - in trunk: aisleriot blackjack/src glines gnect/src gnibbles gnobots2 gnometris gnomine gnotravex gnotski gtali iagno libgames-support mahjongg same-gnome
- Date: Tue, 6 Jan 2009 18:19:39 +0000 (UTC)
Author: chpe
Date: Tue Jan 6 18:19:39 2009
New Revision: 8470
URL: http://svn.gnome.org/viewvc/gnome-games?rev=8470&view=rev
Log:
Move setlocale call and gettext and games-debug initialisation into
games_runtime_init(), and adapt callers accordingly.
Modified:
trunk/aisleriot/sol.c
trunk/blackjack/src/blackjack.cpp
trunk/glines/glines.c
trunk/gnect/src/main.c
trunk/gnibbles/main.c
trunk/gnobots2/gnobots.c
trunk/gnometris/main.cpp
trunk/gnomine/gnomine.c
trunk/gnotravex/gnotravex.c
trunk/gnotski/gnotski.c
trunk/gtali/gyahtzee.c
trunk/iagno/gnothello.c
trunk/libgames-support/games-runtime.c
trunk/libgames-support/render-cards.c
trunk/mahjongg/mahjongg.c
trunk/same-gnome/same-gnome.c
Modified: trunk/aisleriot/sol.c
==============================================================================
--- trunk/aisleriot/sol.c (original)
+++ trunk/aisleriot/sol.c Tue Jan 6 18:19:39 2009
@@ -22,7 +22,6 @@
#include <config.h>
#include <string.h>
-#include <locale.h>
#include <libguile.h>
@@ -681,24 +680,9 @@
int
main (int argc, char *argv[])
{
- setlocale (LC_ALL, "");
-
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS) || defined(HAVE_GSTREAMER)
- /* If we're going to use gnome-vfs or gstreamer, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
- _games_debug_init ();
-
if (!games_runtime_init ("aisleriot"))
return 1;
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
scm_boot_guile (argc, argv, main_prog, NULL); /* no return */
return 0;
Modified: trunk/blackjack/src/blackjack.cpp
==============================================================================
--- trunk/blackjack/src/blackjack.cpp (original)
+++ trunk/blackjack/src/blackjack.cpp Tue Jan 6 18:19:39 2009
@@ -660,21 +660,9 @@
{ NULL }
};
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("blackjack"))
return 1;
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/glines/glines.c
==============================================================================
--- trunk/glines/glines.c (original)
+++ trunk/glines/glines.c Tue Jan 6 18:19:39 2009
@@ -1801,13 +1801,6 @@
EggSMClient *sm_client;
#endif /* WITH_SMCLIENT */
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("glines"))
return 1;
@@ -1815,10 +1808,6 @@
rgen = g_rand_new ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/gnect/src/main.c
==============================================================================
--- trunk/gnect/src/main.c (original)
+++ trunk/gnect/src/main.c Tue Jan 6 18:19:39 2009
@@ -1489,15 +1489,9 @@
gboolean retval;
GError *error = NULL;
- g_thread_init (NULL);
-
if (!games_runtime_init ("gnect"))
return 1;
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
games_sound_add_option_group (context);
Modified: trunk/gnibbles/main.c
==============================================================================
--- trunk/gnibbles/main.c (original)
+++ trunk/gnibbles/main.c Tue Jan 6 18:19:39 2009
@@ -1044,22 +1044,11 @@
gboolean retval;
GError *error = NULL;
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("gnibbles"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
Modified: trunk/gnobots2/gnobots.c
==============================================================================
--- trunk/gnobots2/gnobots.c (original)
+++ trunk/gnobots2/gnobots.c Tue Jan 6 18:19:39 2009
@@ -214,15 +214,9 @@
EggSMClient *sm_client;
#endif /* WITH_SMCLIENT */
- g_thread_init (NULL);
-
if (!games_runtime_init ("gnobots2"))
return 1;
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
gettimeofday (&tv, NULL);
srand (tv.tv_usec);
Modified: trunk/gnometris/main.cpp
==============================================================================
--- trunk/gnometris/main.cpp (original)
+++ trunk/gnometris/main.cpp Tue Jan 6 18:19:39 2009
@@ -38,17 +38,11 @@
gboolean retval;
GError *error = NULL;
- g_thread_init (NULL);
-
if (!games_runtime_init ("gnometris"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain(GETTEXT_PACKAGE);
-
int cmdlineLevel = 0;
const GOptionEntry options[] =
Modified: trunk/gnomine/gnomine.c
==============================================================================
--- trunk/gnomine/gnomine.c (original)
+++ trunk/gnomine/gnomine.c Tue Jan 6 18:19:39 2009
@@ -992,22 +992,11 @@
{NULL}
};
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("gnomine"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/gnotravex/gnotravex.c
==============================================================================
--- trunk/gnotravex/gnotravex.c (original)
+++ trunk/gnotravex/gnotravex.c Tue Jan 6 18:19:39 2009
@@ -416,22 +416,11 @@
EggSMClient *sm_client;
#endif /* WITH_SMCLIENT */
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("gnotravex"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/gnotski/gnotski.c
==============================================================================
--- trunk/gnotski/gnotski.c (original)
+++ trunk/gnotski/gnotski.c Tue Jan 6 18:19:39 2009
@@ -491,22 +491,11 @@
EggSMClient *sm_client;
#endif /* WITH_SMCLIENT */
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("gnotski"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/gtali/gyahtzee.c
==============================================================================
--- trunk/gtali/gyahtzee.c (original)
+++ trunk/gtali/gyahtzee.c Tue Jan 6 18:19:39 2009
@@ -876,17 +876,11 @@
gboolean retval;
GError *error = NULL;
- g_thread_init (NULL);
-
if (!games_runtime_init ("gtali"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
/* Reset all yahtzee variables before parsing args */
YahtzeeInit ();
Modified: trunk/iagno/gnothello.c
==============================================================================
--- trunk/iagno/gnothello.c (original)
+++ trunk/iagno/gnothello.c Tue Jan 6 18:19:39 2009
@@ -979,20 +979,9 @@
EggSMClient *sm_client;
#endif /* WITH_SMCLIENT */
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("iagno"))
return 1;
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/libgames-support/games-runtime.c
==============================================================================
--- trunk/libgames-support/games-runtime.c (original)
+++ trunk/libgames-support/games-runtime.c Tue Jan 6 18:19:39 2009
@@ -20,12 +20,16 @@
#include <config.h>
+#include <locale.h>
+
#if defined (G_OS_WIN32)
#include <windows.h>
#include <io.h>
#define HELP_EXT "xhtml"
#endif /* G_OS_WIN32 */
+#include <glib/gi18n.h>
+
#include "games-debug.h"
#include "games-runtime.h"
@@ -69,13 +73,32 @@
/**
* games_runtime_init:
*
- * Initialises the runtime file localisator.
+ * 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)
{
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain(GETTEXT_PACKAGE);
+
+#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_debug_init ();
+
app_name = g_strdup (name);
#ifdef G_OS_WIN32
Modified: trunk/libgames-support/render-cards.c
==============================================================================
--- trunk/libgames-support/render-cards.c (original)
+++ trunk/libgames-support/render-cards.c Tue Jan 6 18:19:39 2009
@@ -26,6 +26,7 @@
#include <gtk/gtk.h>
+#include "games-runtime.h"
#include "games-card-theme.h"
#include "games-card-theme-private.h"
@@ -64,12 +65,8 @@
{ NULL }
};
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
+ if (!games_runtime_init ("aisleriot"))
+ exit (1);
if (!gtk_init_with_args
(&argc, &argv, NULL, (GOptionEntry *) options, NULL, &err)) {
Modified: trunk/mahjongg/mahjongg.c
==============================================================================
--- trunk/mahjongg/mahjongg.c (original)
+++ trunk/mahjongg/mahjongg.c Tue Jan 6 18:19:39 2009
@@ -1384,22 +1384,11 @@
gboolean retval;
GError *error = NULL;
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("mahjongg"))
return 1;
setgid_io_init ();
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
Modified: trunk/same-gnome/same-gnome.c
==============================================================================
--- trunk/same-gnome/same-gnome.c (original)
+++ trunk/same-gnome/same-gnome.c Tue Jan 6 18:19:39 2009
@@ -141,23 +141,11 @@
gboolean retval;
GError *error = NULL;
-#if defined(HAVE_GNOME) || defined(HAVE_RSVG_GNOMEVFS)
- /* If we're going to use gnome-vfs, we need to init threads before
- * calling any glib functions.
- */
- g_thread_init (NULL);
-#endif
-
if (!games_runtime_init ("same-gnome"))
return 1;
setgid_io_init ();
- /* Initialise i18n. */
- bindtextdomain (GETTEXT_PACKAGE, games_runtime_get_directory (GAMES_RUNTIME_LOCALE_DIRECTORY));
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- textdomain (GETTEXT_PACKAGE);
-
context = g_option_context_new (NULL);
#if GLIB_CHECK_VERSION (2, 12, 0)
g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]