/* Called by c1_CheckEntries. Checks the environment variables on
 * the left side of the upper display (c1_grid1). Returns 0 if they
 * are OK, or 1 if they are not.
 */

#include <gtk/gtk.h>
#include <gtk/gtkx.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include "gddcalc.h"
#include "oneday.h"

bool c1_LocaleOK(c1_widgets *w) {
	
	const gchar *t;

	t = gtk_entry_get_text(GTK_ENTRY(w->c1_entry1));
	if (atof(t) < 42.0 || atof(t) > 46.0) {return FALSE;}
	
	t = gtk_entry_get_text(GTK_ENTRY(w->c1_entry2));
	if (atof(t) > -122.5 || atof(t) < -124.0) {return FALSE;}

	t = gtk_entry_get_text(GTK_ENTRY(w->c1_entry3));
	if (atof(t) < 100 || atof(t) > 600) {return FALSE;}

	t = gtk_entry_get_text(GTK_ENTRY(w->c1_entry4));
	if (atof(t) < 0.0 || atof(t) > 360.0) {return FALSE;}

	t = gtk_entry_get_text(GTK_ENTRY(w->c1_entry5));
	if (atof(t) < -10.0 || atof(t) > 30.0) {return FALSE;}

	return TRUE;
}
