Fixed ordering of the application of the styles
[rodin/chimara.git] / libchimara / init.c
1 #include <config.h>
2 #include <glib.h>
3 #include <glib/gi18n-lib.h>
4
5 static gboolean chimara_initialized = FALSE;
6
7 /* This function is called at every entry point of the library, to set up
8 threads and gettext. It is NOT called from Glk functions. */
9 void
10 chimara_init(void)
11 {
12         if( G_UNLIKELY(!chimara_initialized) )
13         {
14                 /* Setup gettext */
15                 bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
16                 bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
17                 
18                 /* Make sure threads have been initialized */
19                 if(!g_thread_supported())
20                         g_error(_("In order to use the Chimara library, you must initialize"
21                                 " the thread system by calling g_threads_init() and "
22                                 "gdk_threads_init() BEFORE the initial call to gtk_init() in "
23                                 "your main program."));
24                 
25                 /* Initialize thread-private data */
26                 extern GPrivate *glk_data_key;
27                 glk_data_key = g_private_new(NULL);
28         }
29 }
30