X-Git-Url: http://git.tdb.fi/?p=ext%2Fsubsurface.git;a=blobdiff_plain;f=equipment.c;h=9c8ee49a9aea146ce65c76e6af37bb314d97fae6;hp=b74d85b7b6509ab910620c3c2ffe9d8b2e91f099;hb=8cdf1ab59fed02d4740c13f0906dbdbc85043a53;hpb=7fe652ab5738717ba443ae9de2b8f437103fd71b diff --git a/equipment.c b/equipment.c index b74d85b..9c8ee49 100644 --- a/equipment.c +++ b/equipment.c @@ -308,13 +308,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 { + 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; } @@ -623,6 +625,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; @@ -638,6 +641,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); } /*