GritsPoly *poly = grits_poly_parse(sparts[3], "\t", " ", ",");
/* Insert polys into the tree */
- gint id = g_ascii_strtoll(sparts[0], NULL, 10);
+ glong id = g_ascii_strtoll(sparts[0], NULL, 10);
g_tree_insert(counties, (gpointer)id, poly);
/* Insert into states list */
gchar **fipses = g_strsplit(msg->cap.fips6, " ", -1);
GList *counties = NULL;
for (int i = 0; fipses[i]; i++) {
- gint fips = g_ascii_strtoll(fipses[i], NULL, 10);
+ glong fips = g_ascii_strtoll(fipses[i], NULL, 10);
GritsPoly *county = g_tree_lookup(alert->counties, (gpointer)fips);
if (!county)
continue;
(a->info->prior == b->info->prior) ? 0 : 1;
}
+static gboolean _update_end(gpointer _alert)
+{
+ GritsPluginAlert *alert = _alert;
+ gtk_widget_queue_draw(GTK_WIDGET(alert->viewer));
+ return FALSE;
+}
+
static void _update_warnings(GritsPluginAlert *alert, GList *old)
{
g_debug("GritsPluginAlert: _update_warnings");
}
/* Add new messages */
+ /* Load counties first since it does not require network access */
for (GList *cur = alert->msgs; cur; cur = cur->next) {
AlertMsg *msg = cur->data;
msg->county_based = _load_county_based(alert, msg);
+ }
+ g_idle_add(_update_end, alert);
+ for (GList *cur = alert->msgs; cur; cur = cur->next) {
+ AlertMsg *msg = cur->data;
msg->storm_based = _load_storm_based(alert, msg);
}
+ g_idle_add(_update_end, alert);
g_debug("GritsPluginAlert: _load_warnings - end");
}
g_list_foreach(old, (GFunc)msg_free, NULL);
g_list_free(old);
- gtk_widget_queue_draw(GTK_WIDGET(alert->viewer));
g_debug("GritsPluginAlert: _update - end");
}
{
g_debug("GritsPluginAlert: init");
/* Set defaults */
- alert->threads = g_thread_pool_new(_update, alert, 1, TRUE, NULL);
+ alert->threads = g_thread_pool_new(_update, alert, 1, FALSE, NULL);
alert->config = _make_config();
alert->http = grits_http_new(G_DIR_SEPARATOR_S
"alerts" G_DIR_SEPARATOR_S