*
*/
+#ifdef HAVE_CONFIG
+#include "config.h"
+#endif /* HAVE_CONFIG */
+
#include "viking.h"
#include "icons/viking_icon.png_h"
#include "mapcache.h"
#include "background.h"
+#include "dems.h"
#include "curl_download.h"
+#include "preferences.h"
+
+#ifdef VIK_CONFIG_GEOCACHES
+void a_datasource_gc_init();
+#endif
+#include <stdlib.h>
#include <string.h>
+#include <glib/gprintf.h>
+#include <glib/gi18n.h>
+
#include "modules.h"
#define MAX_WINDOWS 1024
}
}
+/* Options */
+static gboolean version = FALSE;
+
+static GOptionEntry entries[] =
+{
+ { "version", 'v', 0, G_OPTION_ARG_NONE, &version, N_("Show version"), NULL },
+ { NULL }
+};
+
int main( int argc, char *argv[] )
{
VikWindow *first_window;
GdkPixbuf *main_icon;
gboolean dashdash_already = FALSE;
int i = 0;
+ GError *error = NULL;
+ gboolean gui_initialized;
+
+ bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
g_thread_init ( NULL );
gdk_threads_init ();
- gtk_init (&argc, &argv);
+ 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 (version)
+ {
+ g_printf ("%s %s, Copyright (c) 2003-2007 Evan Battaglia\n", PACKAGE_NAME, PACKAGE_VERSION);
+ return EXIT_SUCCESS;
+ }
-#ifdef HAVE_LIBCURL
curl_download_init();
-#endif
/* Init modules/plugins */
modules_init();
a_mapcache_init ();
a_background_init ();
+ a_preferences_init ();
+
+#ifdef VIK_CONFIG_GEOCACHES
+ a_datasource_gc_init();
+#endif
+
+ vik_layer_cursors_init ();
+ vik_window_cursors_init ();
/* Set the icon */
main_icon = gdk_pixbuf_from_pixdata(&viking_icon, FALSE, NULL);
gdk_threads_leave ();
a_mapcache_uninit ();
+ a_dems_uninit ();
+ a_preferences_uninit ();
+ vik_layer_cursors_uninit ();
+ vik_window_cursors_uninit ();
return 0;
}