+ /* Defaults */
+ gint debug = 2; // G_LOG_LEVEL_WARNING
+ gchar *site = "";
+ gchar *time = "";
+ gboolean autoupdate = FALSE;
+ gboolean offline = FALSE;
+ gboolean fullscreen = FALSE;
+
+ /* Arguments */
+ gint opt_debug = -1;
+ gchar *opt_site = NULL;
+ gchar *opt_time = NULL;
+ gboolean opt_offline = FALSE;
+ gboolean opt_autoupdate = FALSE;
+ gboolean opt_fullscreen = FALSE;
+ GOptionEntry entries[] = {
+ //long short flg type location description arg desc
+ {"debug", 'd', 0, G_OPTION_ARG_INT, &opt_debug, "Change default log level", "[0-5]"},
+ {"site", 's', 0, G_OPTION_ARG_STRING, &opt_site, "Set initial site", "SITE"},
+ {"time", 't', 0, G_OPTION_ARG_STRING, &opt_time, "Set initial date/time", "DATE"},
+ {"offline", 'o', 0, G_OPTION_ARG_NONE, &opt_offline, "Run in offline mode", NULL},
+ {"autoupdate", 'a', 0, G_OPTION_ARG_NONE, &opt_autoupdate, "Auto update radar", NULL},
+ {"fullscreen", 'f', 0, G_OPTION_ARG_NONE, &opt_fullscreen, "Open in fullscreen mode", NULL},
+ {NULL}
+ };
+
+ /* Init */
+ GError *error = NULL;
+ g_thread_init(NULL);
+ gdk_threads_init();
+ if (!gtk_init_with_args(&argc, &argv, "aweather", entries, NULL, &error)) {
+ g_print("%s\n", error->message);
+ g_error_free(error);
+ return -1;
+ }
+
+ /* Setup debug level for aweather_gui_new */
+ g_log_set_handler(NULL, G_LOG_LEVEL_MASK, log_func, NULL);
+ log_levels = int2log(opt_debug >= 0 ? opt_debug : debug);