Skip to content

Commit

Permalink
Bug 722996 - Cannot add stock price on Price Editor
Browse files Browse the repository at this point in the history
gtk_combo_box_set_active() doesn't work if the model is changed after
the combo box is constructed.
  • Loading branch information
jralls committed Mar 10, 2016
1 parent 71574b7 commit ec83e3a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/gnome-utils/dialog-commodity.c
Expand Up @@ -644,17 +644,17 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
{
GtkComboBox *combo_box;
GtkTreeModel *model;
GtkTreeIter iter;
GtkTreeIter iter, match;
GList *namespaces, *node;
gint current = 0, match = 0;

g_return_if_fail(GTK_IS_COMBO_BOX (cbwe));

/* Erase the old entries */
combo_box = GTK_COMBO_BOX(cbwe);
model = gtk_combo_box_get_model(combo_box);
gtk_list_store_clear(GTK_LIST_STORE(model));
gtk_combo_box_set_active(combo_box, -1);
gtk_tree_model_get_iter_first(model, &match);
gtk_combo_box_set_active_iter(combo_box, &match);

/* fetch a list of the namespaces */
switch (mode)
Expand Down Expand Up @@ -698,11 +698,10 @@ gnc_ui_update_namespace_picker (GtkWidget *cbwe,
}

if (init_string && (g_utf8_collate(node->data, init_string) == 0))
match = current;
current++;
match = iter;
}

gtk_combo_box_set_active(combo_box, match);
gtk_combo_box_set_active_iter(combo_box, &match);
g_list_free(namespaces);
}

Expand Down

0 comments on commit ec83e3a

Please sign in to comment.