]> git.tdb.fi Git - ext/subsurface.git/commitdiff
Add temp/nitrox/sac entries to divelist
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 19 Sep 2011 19:56:37 +0000 (12:56 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 19 Sep 2011 19:56:37 +0000 (12:56 -0700)
This doesn't really fill them, it just adds them to the possible
entries.  I'll get to it later.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
divelist.c
divelist.h

index b724f9239d013c87101962d9ed528bb3ad1c979f..e4b381279f476f9c7265c1b8b2541361b96d4ff8 100644 (file)
@@ -19,6 +19,13 @@ enum {
        DIVE_DEPTH,             /* int: dive->maxdepth in mm */
        DIVE_DURATIONSTR,       /* "47" in minutes */
        DIVE_DURATION,          /* int: in seconds */
+       DIVE_TEMPSTR,           /* "78" in fahrenheit or whatever */
+       DIVE_TEMP,              /* int: in mkelvin */
+       DIVE_NITROXSTR,         /* "32.5" in percent */
+       DIVE_NITROX,            /* int: in permille */
+       DIVE_SACSTR,            /* "0.49" in cuft/min */
+       DIVE_SAC,               /* int: in ml/min or something */
+       DIVELIST_COLUMNS
 };
 
 
@@ -160,11 +167,14 @@ struct DiveList dive_list_create(void)
        GtkCellRenderer   *renderer;
        GtkTreeViewColumn *col;
 
-       dive_list.model = gtk_list_store_new(7,
+       dive_list.model = gtk_list_store_new(DIVELIST_COLUMNS,
                                G_TYPE_INT,                     /* index */
                                G_TYPE_STRING, G_TYPE_INT,      /* Date */
                                G_TYPE_STRING, G_TYPE_INT,      /* Depth */
-                               G_TYPE_STRING, G_TYPE_INT       /* Duration */
+                               G_TYPE_STRING, G_TYPE_INT,      /* Duration */
+                               G_TYPE_STRING, G_TYPE_INT,      /* Temperature */
+                               G_TYPE_STRING, G_TYPE_INT,      /* Nitrox */
+                               G_TYPE_STRING, G_TYPE_INT       /* SAC */
                                );
        dive_list.tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(dive_list.model));
        selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(dive_list.tree_view));
@@ -201,6 +211,36 @@ struct DiveList dive_list_create(void)
        gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
        gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
 
+       renderer = gtk_cell_renderer_text_new();
+       dive_list.temperature = col = gtk_tree_view_column_new();
+       gtk_tree_view_column_set_title(col, "deg");
+       gtk_tree_view_column_set_sort_column_id(col, DIVE_TEMP);
+       gtk_tree_view_column_pack_start(col, renderer, FALSE);
+       gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_TEMPSTR);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
+       gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
+       gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
+
+       renderer = gtk_cell_renderer_text_new();
+       dive_list.nitrox = col = gtk_tree_view_column_new();
+       gtk_tree_view_column_set_title(col, "EAD");
+       gtk_tree_view_column_set_sort_column_id(col, DIVE_NITROX);
+       gtk_tree_view_column_pack_start(col, renderer, FALSE);
+       gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_NITROXSTR);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
+       gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
+       gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
+
+       renderer = gtk_cell_renderer_text_new();
+       dive_list.sac = col = gtk_tree_view_column_new();
+       gtk_tree_view_column_set_title(col, "SAC");
+       gtk_tree_view_column_set_sort_column_id(col, DIVE_SAC);
+       gtk_tree_view_column_pack_start(col, renderer, FALSE);
+       gtk_tree_view_column_add_attribute(col, renderer, "text", DIVE_SACSTR);
+       gtk_tree_view_append_column(GTK_TREE_VIEW(dive_list.tree_view), col);
+       gtk_object_set(GTK_OBJECT(renderer), "alignment", PANGO_ALIGN_RIGHT, NULL);
+       gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), 1.0, 0.5);
+
        fill_dive_list(&dive_list);
 
        g_object_set(G_OBJECT(dive_list.tree_view), "headers-visible", TRUE,
index c046a879a7641f45af269d94cc4e7e2f135244ef..c8bc5ff722c17f2a352f1b646d0278bbbad05a94 100644 (file)
@@ -8,6 +8,7 @@ struct DiveList {
        GtkWidget    *container_widget;
        GtkListStore *model;
        GtkTreeViewColumn *date, *depth, *duration;
+       GtkTreeViewColumn *temperature, *nitrox, *sac;
 };
 
 extern struct DiveList dive_list;