gui: Drop 'dict' parameter from text_to_value().
[pspp] / src / ui / gui / val-labs-dialog.c
index 5f43ff498f10a6c4910a53bec9fc5bfda82a87fb..610e5244dc7de2aebdbe4addff596bd180c87ff4 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPPIRE - a graphical user interface for PSPP.
-   Copyright (C) 2005, 2009  Free Software Foundation
+   Copyright (C) 2005, 2009, 2010, 2011  Free Software Foundation
 
    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
 #include "psppire-var-store.h"
 #include <libpspp/i18n.h>
 
+#include <gettext.h>
+#define _(msgid) gettext (msgid)
+#define N_(msgid) msgid
+
 struct val_labs_dialog
 {
   GtkWidget *window;
@@ -73,7 +77,6 @@ on_label_entry_change (GtkEntry *entry, gpointer data)
   text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry));
 
   text_to_value (text,
-                dialog->dict,
                 dialog->pv,
                 &v);
 
@@ -146,7 +149,6 @@ on_value_entry_change (GtkEntry *entry, gpointer data)
 
   union value v;
   text_to_value (text,
-                dialog->dict,
                 dialog->pv,
                 &v);
 
@@ -188,7 +190,7 @@ val_labs_ok (GtkWidget *w, gpointer data)
 
   val_labs_destroy (dialog->labs);
 
-  dialog->labs = 0;
+  dialog->labs = NULL;
 
   gtk_widget_hide (dialog->window);
 
@@ -202,7 +204,7 @@ val_labs_cancel (struct val_labs_dialog *dialog)
 {
   val_labs_destroy (dialog->labs);
 
-  dialog->labs = 0;
+  dialog->labs = NULL;
 
   gtk_widget_hide (dialog->window);
 }
@@ -257,7 +259,11 @@ get_selected_tuple (struct val_labs_dialog *dialog,
   if (valuep != NULL)
     *valuep = value;
   if (label != NULL)
-    *label = val_labs_find (dialog->labs, &value);
+    {
+      struct val_lab *vl = val_labs_lookup (dialog->labs, &value);
+      if (vl != NULL)
+        *label = val_lab_get_escaped_label (vl);
+    }
 }
 
 
@@ -274,7 +280,6 @@ on_change (GtkWidget *w, gpointer data)
   union value v;
 
   text_to_value (val_text,
-                dialog->dict,
                 dialog->pv,
                 &v);
 
@@ -300,7 +305,6 @@ on_add (GtkWidget *w, gpointer data)
   const gchar *text = gtk_entry_get_text (GTK_ENTRY (dialog->value_entry));
 
   text_to_value (text,
-                dialog->dict,
                 dialog->pv,
                 &v);
 
@@ -453,7 +457,7 @@ val_labs_dialog_create (GtkWindow *toplevel, PsppireVarStore *var_store)
   g_signal_connect (dialog->add_button, "clicked",
                   G_CALLBACK (on_add), dialog);
 
-  dialog->labs = 0;
+  dialog->labs = NULL;
 
   g_object_unref (xml);
 
@@ -508,8 +512,8 @@ repopulate_dialog (struct val_labs_dialog *dialog)
        value_to_text (vl->value, dialog->dict,
                      *var_get_write_format (dialog->pv));
 
-      gchar *const text = g_strdup_printf ("%s = \"%s\"",
-                                          vstr, val_lab_get_label (vl));
+      gchar *const text = g_strdup_printf (_("%s = `%s'"), vstr,
+                                           val_lab_get_escaped_label (vl));
 
       gtk_list_store_append (list_store, &iter);
       gtk_list_store_set (list_store, &iter,