]> git.street.me.uk Git - andy/viking.git/blobdiff - src/main.c
Enable Cache conversion in the Python tool viking-cache.py
[andy/viking.git] / src / main.c
index cc2e499d4f3c593751ce9d395931246889e6c556..1eec76e0cff2b23e4b30616df2dd825b932d8e5c 100644 (file)
@@ -35,6 +35,9 @@
 #include "globals.h"
 #include "vikmapslayer.h"
 #include "vikrouting.h"
+#include "vikutils.h"
+#include "util.h"
+#include "toolbar.h"
 
 #ifdef VIK_CONFIG_GEOCACHES
 void a_datasource_gc_init();
@@ -120,7 +123,9 @@ int main( int argc, char *argv[] )
   bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
   textdomain (GETTEXT_PACKAGE);
 
+#if ! GLIB_CHECK_VERSION (2, 32, 0)
   g_thread_init ( NULL );
+#endif
   gdk_threads_init ();
 
   gui_initialized = gtk_init_with_args (&argc, &argv, "files+", entries, NULL, &error);
@@ -161,6 +166,10 @@ int main( int argc, char *argv[] )
   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 ();
@@ -183,17 +192,26 @@ int main( int argc, char *argv[] )
   a_datasource_gc_init();
 #endif
 
+  a_toolbar_init();
   vik_routing_prefs_init();
 
+  if ( a_vik_get_time_ref_frame() == VIK_TIME_REF_WORLD )
+    vu_setup_lat_lon_tz_lookup();
+
   /* Set the icon */
   main_icon = gdk_pixbuf_from_pixdata(&viking_pixbuf, FALSE, NULL);
   gtk_window_set_default_icon(main_icon);
 
   gdk_threads_enter ();
 
+  // Ask for confirmation of default settings on first run
+  vu_set_auto_features_on_first_run ();
+
   /* Create the first window */
   first_window = vik_window_new_window();
 
+  vu_check_latest_version ( GTK_WINDOW(first_window) );
+
   while ( ++i < argc ) {
     if ( strcmp(argv[i],"--") == 0 && !dashdash_already )
       dashdash_already = TRUE; /* hack to open '-' */
@@ -211,18 +229,26 @@ int main( int argc, char *argv[] )
     }
   }
 
+  vik_window_new_window_finish ( first_window );
+
   gtk_main ();
   gdk_threads_leave ();
 
   a_babel_uninit ();
-
+  a_toolbar_uninit ();
   a_background_uninit ();
   a_mapcache_uninit ();
   a_dems_uninit ();
   a_layer_defaults_uninit ();
   a_preferences_uninit ();
+  a_settings_uninit ();
 
   curl_download_uninit();
 
+  vu_finalize_lat_lon_tz_lookup ();
+
+  // Clean up any temporary files
+  util_remove_all_in_deletion_list ();
+
   return 0;
 }