-/* Occurs when the cancel button is clicked */
-static void
-sort_cases_cancel_callback(GObject *obj, gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- gtk_widget_hide(dialog->window);
-
- g_main_loop_quit(dialog->loop);
-
- dialog->response = GTK_RESPONSE_CANCEL;
-}
-
-/* Occurs when the reset button is clicked */
-static void
-sort_cases_reset_callback(GObject *obj, gpointer data)
-{
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- gtk_arrow_set(dialog->arrow, GTK_ARROW_RIGHT, GTK_SHADOW_OUT);
- dialog->button_state = VAR_SELECT;
-
- gtk_list_store_clear(dialog->criteria_list);
-}
-
-
-/* Add variables currently selected in the dictionary tree view to the
- list of criteria */
-static void
-select_criteria(GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
-{
- GtkTreeIter new_iter;
- gint index;
- gint dir;
- struct variable *variable;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) data;
-
- /* Get the variable from the dictionary */
- gtk_tree_model_get (model, iter,
- DICT_TVM_COL_VAR, &variable,
- -1);
-
- index = var_get_dict_index (variable);
-
- dir = gtk_toggle_button_get_active (dialog->ascending_button) ?
- SRT_ASCEND:SRT_DESCEND;
-
- /* Append to the list of criteria */
- gtk_list_store_append(dialog->criteria_list, &new_iter);
- gtk_list_store_set(dialog->criteria_list,
- &new_iter, CRIT_TVM_IDX, index, -1);
- gtk_list_store_set(dialog->criteria_list,
- &new_iter, CRIT_TVM_DIR, dir, -1);
-}
-
-/* Create a list of the RowRefs which are to be removed from the
- criteria list */
-static void
-path_to_row_ref(GtkTreeModel *model, GtkTreePath *path,
- GtkTreeIter *iter, gpointer data)
-{
- GList **rrlist = data;
- GtkTreeRowReference *rowref = gtk_tree_row_reference_new(model, path);
-
- *rrlist = g_list_append(*rrlist, rowref);
-}
-
-
-/* Remove a row from the list of criteria */
-static void
-deselect_criteria(gpointer data,
- gpointer user_data)
-{
- GtkTreeIter iter;
- GtkTreeRowReference *row_ref = data;
- GtkTreePath *path;
- struct sort_cases_dialog *dialog = (struct sort_cases_dialog*) user_data;
-
- path = gtk_tree_row_reference_get_path(row_ref);
-
- gtk_tree_model_get_iter(GTK_TREE_MODEL(dialog->criteria_list), &iter, path);
-
- gtk_list_store_remove(dialog->criteria_list, &iter);
-
- gtk_tree_row_reference_free(row_ref);
-}
-
-
-
-/* Callback which occurs when the button to remove variables from the list
- of criteria is clicked. */
-static void
-sort_cases_button_callback(GObject *obj, gpointer data)