#include <stdlib.h>
#include <gtk/gtk.h>
-#include <gtksheet/psppire-marshal.h>
+#include <ui/gui/psppire-marshal.h>
#include "psppire-dict.h"
#include <data/dictionary.h>
#include <data/missing-values.h>
#include <data/value-labels.h>
#include <data/variable.h>
+#include <libpspp/i18n.h>
#include "helper.h"
#include "message-dialog.h"
G_SIGNAL_RUN_FIRST,
0,
NULL, NULL,
- marshaller_VOID__INT_INT_INT,
+ psppire_marshal_VOID__INT_INT_INT,
G_TYPE_NONE,
3,
G_TYPE_INT,
PsppireDict*
psppire_dict_new_from_dict (struct dictionary *d)
{
- PsppireDict *new_dict = g_object_new (G_TYPE_PSPPIRE_DICT, NULL);
+ PsppireDict *new_dict = g_object_new (PSPPIRE_TYPE_DICT, NULL);
new_dict->dict = d;
dict_set_callbacks (new_dict->dict, &gui_callbacks, new_dict);
-/* Return the IDXth variable */
+/* Return the IDXth variable.
+ Will return NULL if IDX exceeds the number of variables in the dictionary.
+ */
struct variable *
psppire_dict_get_variable (const PsppireDict *d, gint idx)
{
{
case DICT_TVM_COL_NAME:
{
- gchar *name = pspp_locale_to_utf8(var_get_name (var), -1, NULL);
- g_value_init (value, G_TYPE_STRING);
- g_value_set_string (value, name);
- g_free (name);
+ gchar *name = recode_string (UTF8, psppire_dict_encoding (dict),
+ var_get_name (var), -1);
+ g_value_init (value, G_TYPE_STRING);
+ g_value_set_string (value, name);
+ g_free (name);
}
break;
case DICT_TVM_COL_VAR:
}
}
#endif
+
+
+
+
+const gchar *
+psppire_dict_encoding (const PsppireDict *dict)
+{
+ return dict_get_encoding (dict->dict);
+}