Rewrite of LXAppearance.
[lxde/lxappearance.git] / src / lxappearance2.c
1 /*
2 * lxappearance2.c
3 *
4 * Copyright 2010 PCMan <pcman.tw@gmail.com>
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 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22 #ifdef HAVE_CONFIG_H
23 #include <config.h>
24 #endif
25
26 #include <gtk/gtk.h>
27 #include <glib/gi18n.h>
28 #include "widget-theme.h"
29 #include "icon-theme.h"
30 #include "cursor-theme.h"
31
32 static GOptionEntry option_entries[] =
33 {
34 { NULL }
35 };
36
37 int main(int argc, char** argv)
38 {
39 GError* err = NULL;
40 GtkBuilder* b;
41 GtkWidget* win;
42
43 /* gettext support */
44 #ifdef ENABLE_NLS
45 bindtextdomain ( GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR );
46 bind_textdomain_codeset ( GETTEXT_PACKAGE, "UTF-8" );
47 textdomain ( GETTEXT_PACKAGE );
48 #endif
49
50 /* init threading support */
51 /*
52 g_thread_init(NULL);
53 gdk_threads_init();
54 */
55
56 /* initialize GTK+ and parse the command line arguments */
57 if( G_UNLIKELY( ! gtk_init_with_args( &argc, &argv, "", option_entries, GETTEXT_PACKAGE, &err ) ) )
58 {
59 g_print( "Error: %s\n", err->message );
60 return 1;
61 }
62
63 /* create GUI here */
64 b = gtk_builder_new();
65 if(!gtk_builder_add_from_file(b, PACKAGE_UI_DIR "/lxappearance.ui", NULL))
66 return 1;
67
68 widget_theme_init(b);
69 icon_theme_init(b);
70 cursor_theme_init(b);
71
72 win = gtk_builder_get_object(b, "dlg");
73
74 gtk_window_present(GTK_WINDOW(win));
75 g_object_unref(b);
76
77 gtk_main();
78
79 return 0;
80 }