- gtk_tree_view_column_set_sizing (dialog->crit_col, GTK_TREE_VIEW_COLUMN_FIXED);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->criteria_view),
- dialog->crit_col);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (criteria_selection_changed), dialog);
- }
-
- {
- /* Create the list of criteria */
- dialog->criteria_list = gtk_list_store_new (2,
- G_TYPE_INT, /* index of the variable */
- G_TYPE_INT /* Ascending/Descending */
- );
-
- gtk_tree_view_set_model (dialog->criteria_view,
- GTK_TREE_MODEL (dialog->criteria_list));
- }
-
- dialog->response = GTK_RESPONSE_NONE;
-
- return dialog;
-}
-
-
-static void
-convert_list_store_to_criteria (GtkListStore *list,
- PsppireDict *dict,
- struct sort_criteria *criteria);
-
-
-/* Run the dialog.
- If the return value is GTK_RESPONSE_OK, then CRITERIA gets filled
- with a valid sort criteria which can be used to sort the data.
- This structure and its contents must be freed by the caller. */
-gint
-sort_cases_dialog_run (struct sort_cases_dialog *dialog,
- PsppireDict *dict,
- struct sort_criteria *criteria
- )
-{
- g_assert (! g_main_loop_is_running (dialog->loop));
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->dict_view),
- GTK_TREE_MODEL (dict));
-
-
- gtk_tree_view_column_set_cell_data_func (dialog->crit_col,
- dialog->crit_renderer,
- criteria_render_func, dict, 0);
-
- gtk_list_store_clear (dialog->criteria_list);
-
- gtk_arrow_set (dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_SELECT;
-
- gtk_widget_show (dialog->window);
-
- g_main_loop_run (dialog->loop);
-
- if ( GTK_RESPONSE_OK == dialog->response)
- convert_list_store_to_criteria (dialog->criteria_list,
- dict, criteria);
-
- return dialog->response;
-}
-
-
-
-/* Convert the GtkListStore to a struct sort_criteria*/
-static void
-convert_list_store_to_criteria (GtkListStore *list,
- PsppireDict *dict,
- struct sort_criteria *criteria)
-{
- GtkTreeIter iter;
- gboolean valid;
- gint n = 0;
-
- GtkTreeModel *model = GTK_TREE_MODEL (list);
-
- criteria->crit_cnt = gtk_tree_model_iter_n_children (model, NULL);
-
- criteria->crits = g_malloc (sizeof (struct sort_criterion) *
- criteria->crit_cnt);
-
- for (valid = gtk_tree_model_get_iter_first (model, &iter);
- valid;
- valid = gtk_tree_model_iter_next (model, &iter))