General code cleanup
[projects/chimara/chimara.git] / player / main.c
1 /*
2  * Copyright (C) 2008, 2009, 2010, 2011 Philip Chimento and Marijn van Vliet.
3  * All rights reserved.
4  *
5  * Chimara is free software copyrighted by Philip Chimento and Marijn van Vliet.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  * 2. Redistributions in binary form must reproduce the above copyright
14  *    notice, this list of conditions and the following disclaimer in the
15  *    documentation and/or other materials provided with the distribution.
16  * 3. Neither of the names Philip Chimento or Marijn van Vliet, nor the name of
17  *    any other contributor may be used to endorse or promote products derived
18  *    from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
24  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
27  * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
30  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #include <glib.h>
34 #include <gtk/gtk.h>
35 #include "app.h"
36
37 int
38 main(int argc, char *argv[])
39 {
40 #ifdef ENABLE_NLS
41         bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
42         bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
43         textdomain(GETTEXT_PACKAGE);
44 #endif
45
46         if( !g_thread_supported() )
47                 g_thread_init(NULL);
48         gdk_threads_init();
49         gtk_init(&argc, &argv);
50
51         ChimaraApp *theapp = chimara_app_get();
52
53         //if(argc == 3) {
54         //      g_object_set(glk, "graphics-file", argv[2], NULL);
55         //}
56         //if(argc >= 2) {
57         //      if( !chimara_if_run_game(CHIMARA_IF(glk), argv[1], &error) ) {
58         //              error_dialog(GTK_WINDOW(window), error, "Error starting Glk library: ");
59         //              return 1;
60         //      }
61         //}
62
63         gtk_widget_show_all(theapp->browser_window);
64
65     gdk_threads_enter();
66         gtk_main();
67         gdk_threads_leave();
68
69         g_object_unref(theapp);
70
71         return 0;
72 }