1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
2  *
3  *  Copyright (C) 2002 Jorn Baayen
4  *  Copyright (C) 2003,2004 Colin Walters <walters@gnome.org>
5  *
6  *  This program is free software; you can redistribute it and/or modify
7  *  it under the terms of the GNU General Public License as published by
8  *  the Free Software Foundation; either version 2, or (at your option)
9  *  any later version.
10  *
11  *  The Rhythmbox authors hereby grant permission for non-GPL compatible
12  *  GStreamer plugins to be used and distributed together with GStreamer
13  *  and Rhythmbox. This permission is above and beyond the permissions granted
14  *  by the GPL license by which Rhythmbox is covered. If you modify this code
15  *  you may extend this exception to your version of the code, but you are not
16  *  obligated to do so. If you do not wish to do so, delete this exception
17  *  statement from your version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA.
27  *
28  */
29 
30 #include <config.h>
31 
32 #include <locale.h>
33 
34 #include <glib/gi18n.h>
35 #include <gtk/gtk.h>
36 
37 #ifdef GDK_WINDOWING_X11
38 /* X11 headers */
39 #include <X11/Xlib.h>
40 #endif
41 
42 #include <girepository.h>
43 
44 #include "rb-shell.h"
45 #include "rb-util.h"
46 #include "rb-debug.h"
47 #include "rb-application.h"
48 
49 int
main(int argc,char ** argv)50 main (int argc, char **argv)
51 {
52 	GApplication *app;
53 	int rc;
54 
55 #ifdef GDK_WINDOWING_X11
56 	if (XInitThreads () == 0) {
57 		g_critical ("Initialising threading support failed.");
58 		return 1;
59 	}
60 #endif
61 
62 	g_random_set_seed (time (0));
63 
64 #ifdef USE_UNINSTALLED_DIRS
65 	g_setenv ("GSETTINGS_SCHEMA_DIR", SHARE_UNINSTALLED_BUILDDIR, TRUE);
66 #endif
67 
68 	setlocale (LC_ALL, NULL);
69 
70 #ifdef ENABLE_NLS
71 	/* initialize i18n */
72 	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
73 	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
74 
75 	textdomain (GETTEXT_PACKAGE);
76 #endif
77 
78 	g_set_application_name (_("Rhythmbox"));
79 	gtk_window_set_default_icon_name ("rhythmbox");
80 
81 #if defined(USE_UNINSTALLED_DIRS)
82 	g_irepository_prepend_search_path (SHARE_UNINSTALLED_BUILDDIR "/../bindings/gi");
83 #endif
84 
85 	rb_threads_init ();
86 
87 	app = rb_application_new ();
88 	rc = rb_application_run (RB_APPLICATION (app), argc, argv);
89 	g_object_unref (app);
90 
91 	return rc;
92 }
93