diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2011-10-23 08:50:14 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2011-10-23 09:09:00 -0700 |
commit | b091916249c940666b249d253f082ef5dad75411 (patch) | |
tree | 1f17f715b5f2e119e0c9225dc2b14257dc3533bc | |
parent | 86fdd83e7b9cc661940470c7b7d83316b223f572 (diff) | |
download | subsurface-b091916249c940666b249d253f082ef5dad75411.tar.gz |
Show dive number in dive list
Make sure that renumbering the divelist correctly shows up on the display.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | divelist.c | 7 | ||||
-rw-r--r-- | main.c | 1 |
2 files changed, 7 insertions, 1 deletions
diff --git a/divelist.c b/divelist.c index 5f2063e9f..4146deca7 100644 --- a/divelist.c +++ b/divelist.c @@ -25,7 +25,7 @@ struct DiveList { GtkWidget *tree_view; GtkWidget *container_widget; GtkListStore *model; - GtkTreeViewColumn *date, *depth, *duration, *location; + GtkTreeViewColumn *nr, *date, *depth, *duration, *location; GtkTreeViewColumn *temperature, *cylinder, *nitrox, *sac, *otu; int changed; }; @@ -38,6 +38,7 @@ static struct DiveList dive_list; */ enum { DIVE_INDEX = 0, + DIVE_NR, /* int: dive->nr */ DIVE_DATE, /* time_t: dive->when */ DIVE_DEPTH, /* int: dive->maxdepth in mm */ DIVE_DURATION, /* int: in seconds */ @@ -375,6 +376,7 @@ static void fill_one_dive(struct dive *dive, * The core data itself is unaffected by units */ gtk_list_store_set(GTK_LIST_STORE(model), iter, + DIVE_NR, dive->number, DIVE_LOCATION, location, DIVE_CYLINDER, cylinder, DIVE_SAC, sac, @@ -469,6 +471,7 @@ static void fill_dive_list(void) gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, DIVE_INDEX, i, + DIVE_NR, dive->number, DIVE_DATE, dive->when, DIVE_DEPTH, dive->maxdepth, DIVE_DURATION, dive->duration.seconds, @@ -515,6 +518,7 @@ GtkWidget *dive_list_create(void) dive_list.model = gtk_list_store_new(DIVELIST_COLUMNS, G_TYPE_INT, /* index */ + G_TYPE_INT, /* nr */ G_TYPE_INT, /* Date */ G_TYPE_INT, /* Depth */ G_TYPE_INT, /* Duration */ @@ -533,6 +537,7 @@ GtkWidget *dive_list_create(void) gtk_tree_selection_set_mode(GTK_TREE_SELECTION(selection), GTK_SELECTION_MULTIPLE); gtk_widget_set_size_request(dive_list.tree_view, 200, 200); + dive_list.nr = divelist_column(&dive_list, DIVE_NR, "#", NULL, PANGO_ALIGN_RIGHT, TRUE); dive_list.date = divelist_column(&dive_list, DIVE_DATE, "Date", date_data_func, PANGO_ALIGN_LEFT, TRUE); dive_list.depth = divelist_column(&dive_list, DIVE_DEPTH, "ft", depth_data_func, PANGO_ALIGN_RIGHT, TRUE); dive_list.duration = divelist_column(&dive_list, DIVE_DURATION, "min", duration_data_func, PANGO_ALIGN_RIGHT, TRUE); @@ -203,6 +203,7 @@ void renumber_dives(int nr) for (i = 0; i < dive_table.nr; i++) { struct dive *dive = dive_table.dives[i]; dive->number = nr + i; + flush_divelist(dive); } mark_divelist_changed(TRUE); } |