Converted strings to utf8 before passing to gtksheet. Should work properly now with
[pspp-builds.git] / src / ui / gui / data-sheet.c
index 1edeb330f8d101abae48aebd58a22ece2f89e433..20869dcb0b0939466fdb16e3847779a83c8ca547 100644 (file)
 
 #include <ctype.h>
 
-#include "gtksheet.h"
+#include <gtksheet/gtksheet.h>
 
-#include "gsheet-uniform-row.h"
+#include <gtksheet/gsheet-uniform-row.h>
 
 #include "psppire-dict.h"
 #include "psppire-variable.h"
 #include "psppire-data-store.h"
 #include "helper.h"
 
-#include "value-labels.h"
-#include "case.h"
-#include "data-in.h"
+#include <data/value-labels.h>
+#include <data/case.h>
+#include <data/data-in.h>
 
 #include "menu-actions.h"
 #include "data-sheet.h"
@@ -70,9 +70,10 @@ static gboolean
 click2column(GtkWidget *w, gint col, gpointer data)
 {
   gint current_row, current_column;
-  select_sheet(PAGE_VAR_SHEET);
   GtkWidget *var_sheet  = get_widget_assert(xml, "variable_sheet");
 
+  select_sheet(PAGE_VAR_SHEET);
+
   gtk_sheet_get_active_cell(GTK_SHEET(var_sheet), 
                            &current_row, &current_column);
 
@@ -86,26 +87,35 @@ click2column(GtkWidget *w, gint col, gpointer data)
 static gint 
 update_data_ref_entry(GtkSheet *sheet, gint row, gint col)
 {
+
   /* The entry where the reference to the current cell is displayed */
   GtkEntry *cell_ref_entry;
 
   PsppireDataStore *data_store = PSPPIRE_DATA_STORE(gtk_sheet_get_model(sheet));
+  if (data_store)
+    {
+      const struct PsppireVariable *pv = 
+       psppire_dict_get_variable(data_store->dict, col);
 
+      gchar *text ;
+      gchar *s ;
 
-  if ( !xml) 
-    return FALSE;
-
-  const struct PsppireVariable *pv = 
-    psppire_dict_get_variable(data_store->dict, col);
+      if ( !xml) 
+       return FALSE;
 
-  gchar *text = g_strdup_printf("%d: %s", row, 
-                               pv ? psppire_variable_get_name(pv) : "");
+      text = g_strdup_printf("%d: %s", row, 
+                            pv ? psppire_variable_get_name(pv) : "");
   
-  cell_ref_entry = GTK_ENTRY(get_widget_assert(xml, "cell_ref_entry"));
+      cell_ref_entry = GTK_ENTRY(get_widget_assert(xml, "cell_ref_entry"));
+
+      s = pspp_locale_to_utf8(text, -1, 0);
+
+      g_free(text);
 
-  gtk_entry_set_text(cell_ref_entry, text);
+      gtk_entry_set_text(cell_ref_entry, s);
 
-  g_free(text);
+      g_free(s);
+    }
 
   return FALSE;
 }
@@ -119,7 +129,6 @@ psppire_data_sheet_create (gchar *widget_name, gchar *string1, gchar *string2,
                           gint int1, gint int2)
 {
   GtkWidget *sheet;
-  gint i;
 
   const gint rows = 10046;