X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=main.c;h=9ef4fa0b4b6b9eff42fa0b28d3c506bc6d9b35a6;hb=05857e0a05bc15672ddd5e835714d2cd20405b97;hp=14c4f26fe2952e8a1ac4324584c86fac87edb18e;hpb=a5a3cba574d5f4a742f57eef590c44da6355d6f6;p=ext%2Fsubsurface.git diff --git a/main.c b/main.c index 14c4f26..9ef4fa0 100644 --- a/main.c +++ b/main.c @@ -14,6 +14,8 @@ GtkWidget *error_label; int error_count; struct DiveList dive_list; +struct units output_units; + static int sortfn(const void *_a, const void *_b) { const struct dive *a = *(void **)_a; @@ -200,11 +202,23 @@ static void quit(GtkWidget *w, gpointer data) gtk_main_quit(); } +static void imperial(GtkWidget *w, gpointer data) +{ + output_units = IMPERIAL_units; +} + +static void metric(GtkWidget *w, gpointer data) +{ + output_units = SI_units; +} + static GtkActionEntry menu_items[] = { { "FileMenuAction", GTK_STOCK_FILE, "Log", NULL, NULL, NULL}, { "OpenFile", GTK_STOCK_OPEN, NULL, "O", NULL, G_CALLBACK(file_open) }, { "SaveFile", GTK_STOCK_SAVE, NULL, "S", NULL, G_CALLBACK(file_save) }, { "Quit", GTK_STOCK_QUIT, NULL, "Q", NULL, G_CALLBACK(quit) }, + { "Metric", NULL, "Metric", NULL, NULL, G_CALLBACK(metric) }, + { "Imperial", NULL, "Imperial", NULL, NULL, G_CALLBACK(imperial) }, }; static gint nmenu_items = sizeof (menu_items) / sizeof (menu_items[0]); @@ -215,6 +229,9 @@ static const gchar* ui_string = " \ \ \ \ + \ + \ + \ \ \ \ @@ -249,6 +266,7 @@ int main(int argc, char **argv) GtkWidget *menubar; GtkWidget *vbox; + output_units = SI_units; parse_xml_init(); gtk_init(&argc, &argv);