From 73798607bf6684e1ca927e22055eb518ab8bd013 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Sat, 26 Mar 2011 12:20:27 +1100 Subject: [PATCH] Make set default units work for both currency and conversions --- src/math-converter.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/math-converter.c b/src/math-converter.c index 28d380fa..4eb2cbc8 100644 --- a/src/math-converter.c +++ b/src/math-converter.c @@ -225,12 +225,16 @@ math_converter_set_conversion(MathConverter *converter, /*const gchar *category, if (!ua || !ub) { GtkTreeModel *model; - GtkTreeIter iter, child_iter; + GtkTreeIter iter; /* Select the first unit */ model = gtk_combo_box_get_model(GTK_COMBO_BOX(converter->priv->from_combo)); - if (gtk_tree_model_get_iter_first(model, &iter) && gtk_tree_model_iter_children(model, &child_iter, &iter)) - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(converter->priv->from_combo), &child_iter); + if (gtk_tree_model_get_iter_first(model, &iter)) { + GtkTreeIter child_iter; + while (gtk_tree_model_iter_children(model, &child_iter, &iter)) + iter = child_iter; + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(converter->priv->from_combo), &iter); + } return; } -- 2.11.4.GIT