gui: Make syntax execution functions take a PsppireDataWindow argument.
[pspp-builds.git] / src / ui / gui / psppire-data-editor.c
index 094a4f6988ada771e840e81b037be42e9b5203db..99bc90744e1da402c74b30a9cc4742166ee495c5 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    along with this program.  If not, see <http://www.gnu.org/licenses/>. */
 
 #include <config.h>
-#include <gtk/gtksignal.h>
 #include <gtk/gtk.h>
 #include <gtk-contrib/gtkextra-sheet.h>
 #include "psppire-data-editor.h"
 #include "psppire-var-sheet.h"
+#include "psppire.h"
 
 #include "psppire-data-store.h"
 #include <libpspp/i18n.h>
@@ -1246,15 +1246,15 @@ popup_cases_menu (PsppireSheet *sheet, gint row,
 /* Sorting */
 
 static void
-do_sort (PsppireDataStore *ds, int var, gboolean descend)
+do_sort (PsppireDataEditor *de, int var, gboolean descend)
 {
-  const struct variable *v =
-    psppire_dict_get_variable (ds->dict, var);
+  const struct variable *v
+    = psppire_dict_get_variable (de->data_store->dict, var);
   gchar *syntax;
 
   syntax = g_strdup_printf ("SORT CASES BY %s%s.",
                             var_get_name (v), descend ? " (D)" : "");
-  g_free (execute_syntax_string (syntax));
+  g_free (execute_syntax_string (psppire_default_data_window (), syntax));
 }
 
 
@@ -1266,7 +1266,7 @@ psppire_data_editor_sort_ascending  (PsppireDataEditor *de)
   PsppireSheetRange range;
   psppire_sheet_get_selected_range (PSPPIRE_SHEET(de->data_sheet[0]), &range);
 
-  do_sort (de->data_store,  range.col0, FALSE);
+  do_sort (de,  range.col0, FALSE);
 }
 
 
@@ -1278,7 +1278,7 @@ psppire_data_editor_sort_descending (PsppireDataEditor *de)
   PsppireSheetRange range;
   psppire_sheet_get_selected_range (PSPPIRE_SHEET(de->data_sheet[0]), &range);
 
-  do_sort (de->data_store,  range.col0, TRUE);
+  do_sort (de,  range.col0, TRUE);
 }
 
 
@@ -1612,8 +1612,7 @@ data_sheet_set_clip (PsppireSheet *sheet)
     }
 
   /* Construct clip dictionary. */
-  clip_dict = dict_create ();
-  dict_set_encoding (clip_dict, dict_get_encoding (ds->dict->dict));
+  clip_dict = dict_create (dict_get_encoding (ds->dict->dict));
   for (i = col0; i <= coli; i++)
     dict_clone_var_assert (clip_dict, dict_get_var (ds->dict->dict, i));