mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
a5a3cba574
commit
05857e0a05
3 changed files with 68 additions and 36 deletions
18
main.c
18
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, "<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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue