# HG changeset patch # User Mark Doliner # Date 1185899458 0 # Node ID d54fecfe6bf79fb1d12c7c92ef77b001d13ff192 # Parent 9b0fd9a4d01b8c55c7dc098b5ccc1596e98d74a9 Fix a bug with multi-field selections in Pidgin's implementation of the request API where, if a field had multiple selected values then only the first one would show up as selected. diff -r 9b0fd9a4d01b -r d54fecfe6bf7 pidgin/gtkrequest.c --- a/pidgin/gtkrequest.c Tue Jul 31 16:11:21 2007 +0000 +++ b/pidgin/gtkrequest.c Tue Jul 31 16:30:58 2007 +0000 @@ -1003,9 +1003,6 @@ if (purple_request_field_list_get_multi_select(field)) gtk_tree_selection_set_mode(sel, GTK_SELECTION_MULTIPLE); - g_signal_connect(G_OBJECT(sel), "changed", - G_CALLBACK(list_field_select_changed_cb), field); - column = gtk_tree_view_column_new(); gtk_tree_view_insert_column(GTK_TREE_VIEW(treeview), column, -1); @@ -1028,6 +1025,17 @@ gtk_tree_selection_select_iter(sel, &iter); } + /* + * We only want to catch changes made by the user, so it's important + * that we wait until after the list is created to connect this + * handler. If we connect the handler before the loop above and + * there are multiple items selected, then selecting the first iter + * in the tree causes list_field_select_changed_cb to be triggered + * which clears out the rest of the list of selected items. + */ + g_signal_connect(G_OBJECT(sel), "changed", + G_CALLBACK(list_field_select_changed_cb), field); + gtk_container_add(GTK_CONTAINER(sw), treeview); gtk_widget_show(treeview);