1 /*
2  * This file is part of GtkEveMon.
3  *
4  * GtkEveMon is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * You should have received a copy of the GNU General Public License
10  * along with GtkEveMon. If not, see <http://www.gnu.org/licenses/>.
11  */
12 
13 #include <csignal> // for ::signal()
14 #include <cstdlib> // for EXIT_SUCCESS
15 
16 #include <gtkmm.h>
17 
18 #include "api/evetime.h"
19 #include "bits/argumentsettings.h"
20 #include "bits/serverlist.h"
21 #include "bits/config.h"
22 #include "bits/server.h"
23 #include "bits/updater.h"
24 #include "gui/imagestore.h"
25 #include "gui/maingui.h"
26 
27 void
signal_received(int)28 signal_received (int /*signum*/)
29 {
30   Gtk::Main::quit();
31 }
32 
33 /* ---------------------------------------------------------------- */
34 
35 int
main(int argc,char * argv[])36 main (int argc, char* argv[])
37 {
38 #ifdef WIN32
39   if (!Glib::thread_supported())
40     Glib::thread_init();
41 #endif
42 
43   Gtk::Main kit(&argc, &argv);
44   ArgumentSettings::init(argc, argv);
45   Config::init_defaults();
46   Config::init_config_path();
47   Config::init_user_config();
48 
49   ImageStore::init();
50 
51   Updater::check_data_files();
52 
53   ServerList::init_from_config();
54   EveTime::init_from_config();
55 
56   std::signal(SIGINT, signal_received);
57   std::signal(SIGTERM, signal_received);
58 
59   {
60     MainGui gui;
61     kit.run();
62   }
63 
64   EveTime::store_to_config();
65   ServerList::unload();
66   ImageStore::unload();
67 
68   Config::unload();
69 
70   return EXIT_SUCCESS;
71 }
72