Merge commit 'origin/master' into charset
[pspp-builds.git] / src / ui / gui / psppire-dict.c
index 91293956b9e8e2ab613b83b719674c1b54e7bc97..afc7d570c9afe6ab85f637344b9b46a9340bc711 100644 (file)
@@ -26,6 +26,7 @@
 #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"
@@ -315,7 +316,7 @@ psppire_dict_init (PsppireDict *psppire_dict)
 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);
@@ -752,10 +753,11 @@ tree_model_get_value (GtkTreeModel *model, GtkTreeIter *iter,
     {
     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:
@@ -859,3 +861,12 @@ psppire_dict_dump (const PsppireDict *dict)
     }
 }
 #endif
+
+
+
+
+const gchar *
+psppire_dict_encoding (const PsppireDict *dict)
+{
+  return dict_get_encoding (dict->dict);
+}