diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-06 19:07:17 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-06 19:07:17 -0700 |
commit | 05857e0a05bc15672ddd5e835714d2cd20405b97 (patch) | |
tree | ccebf7f5b18082538c7d8d9fe46ce9e329150da2 /main.c | |
parent | a5a3cba574d5f4a742f57eef590c44da6355d6f6 (diff) | |
download | subsurface-05857e0a05bc15672ddd5e835714d2cd20405b97.tar.gz |
Start "output unit management" support
This doesn't actually *do* anything yet, but it introduces the notion of
output units, and allows you to pick metric or imperial.
Of course, since the output doesn't currently care, the units you pick
are irrelevant. But just wait..
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -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, "<control>O", NULL, G_CALLBACK(file_open) }, { "SaveFile", GTK_STOCK_SAVE, NULL, "<control>S", NULL, G_CALLBACK(file_save) }, { "Quit", GTK_STOCK_QUIT, NULL, "<control>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 = " \ <menuitem name=\"Open\" action=\"OpenFile\" /> \ <menuitem name=\"Save\" action=\"SaveFile\" /> \ <separator name=\"Seperator\"/> \ + <menuitem name=\"Metric\" action=\"Metric\" /> \ + <menuitem name=\"Imperial\" action=\"Imperial\" /> \ + <separator name=\"Seperator\"/> \ <menuitem name=\"Quit\" action=\"Quit\" /> \ </menu> \ </menubar> \ @@ -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); |