X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=blobdiff_plain;f=equipment.c;h=71639c9d14b3c0cc7bb4fe1c05183ccbbd62852d;hp=ccfeb1270c7bb42883acca8e13558ea3f65024c4;hb=9b72217f79f29313d30c87c55f533cc606da6a8f;hpb=e6ecddfa3d17901847474b67b6121c0c8f56f078 diff --git a/equipment.c b/equipment.c index ccfeb12..71639c9 100644 --- a/equipment.c +++ b/equipment.c @@ -309,13 +309,15 @@ static GtkTreeIter *add_weightsystem_type(const char *desc, int weight, GtkTreeI model = GTK_TREE_MODEL(weightsystem_model); gtk_tree_model_foreach(model, match_desc, (void *)desc); - if (!found_match) { - GtkListStore *store = GTK_LIST_STORE(model); - - gtk_list_store_append(store, iter); - gtk_list_store_set(store, iter, - 0, desc, - 1, weight, + if (found_match) { + gtk_list_store_set(GTK_LIST_STORE(model), found_match, + WS_WEIGHT, weight, + -1); + } else if (desc && desc[0]) { + gtk_list_store_append(GTK_LIST_STORE(model), iter); + gtk_list_store_set(GTK_LIST_STORE(model), iter, + WS_DESC, desc, + WS_WEIGHT, weight, -1); return iter; } @@ -624,6 +626,7 @@ static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *we GtkComboBox *box; int grams; double value; + GtkTreeIter iter; /* Ignore uninitialized cylinder widgets */ box = weightsystem_widget->description; @@ -639,6 +642,7 @@ static void record_weightsystem_changes(weightsystem_t *ws, struct ws_widget *we grams = value * 1000; ws->weight.grams = grams; ws->description = desc; + add_weightsystem_type(desc, grams, &iter); } /* @@ -745,8 +749,6 @@ static struct ws_info { const char *name; int grams; } ws_info[100] = { - /* Need an empty entry for the no weight system case */ - { "", }, { "integrated", 0 }, { "belt", 0 }, { "ankle", 0 },