+ gui_initialized = gtk_init_with_args (&argc, &argv, "files+", entries, NULL, &error);
+ if (!gui_initialized)
+ {
+ /* check if we have an error message */
+ if (error == NULL)
+ {
+ /* no error message, the GUI initialization failed */
+ const gchar *display_name = gdk_get_display_arg_name ();
+ g_fprintf (stderr, "Failed to open display: %s\n", (display_name != NULL) ? display_name : " ");
+ }
+ else
+ {
+ /* yep, there's an error, so print it */
+ g_fprintf (stderr, "Parsing command line options failed: %s\n", error->message);
+ g_error_free (error);
+ g_fprintf (stderr, "Run \"%s --help\" to see the list of recognized options.\n",argv[0]);
+ }
+ return EXIT_FAILURE;
+ }
+
+ if (vik_version)
+ {
+ g_printf ("%s %s\nCopyright (c) 2003-2008 Evan Battaglia\nCopyright (c) 2008-2012 Viking's contributors\n", PACKAGE_NAME, PACKAGE_VERSION);
+ return EXIT_SUCCESS;
+ }
+
+#if GLIB_CHECK_VERSION (2, 32, 0)
+ if (vik_debug)
+ g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, log_debug, NULL);
+#else
+ if (!vik_debug)
+ g_log_set_handler (NULL, G_LOG_LEVEL_DEBUG, mute_log, NULL);
+#endif
+
+#if HAVE_X11_XLIB_H
+ XSetErrorHandler(myXErrorHandler);
+#endif
+
+ // Discover if this is the very first run
+ a_vik_very_first_run ();
+
+ a_settings_init ();
+ a_preferences_init ();
+
+ a_vik_preferences_init ();
+
+ a_layer_defaults_init ();
+
+ a_download_init();
+ curl_download_init();
+
+ a_babel_init ();