5 #include "message-dialog.h"
6 #include <data/data-in.h>
7 #include <data/data-out.h>
8 #include <libpspp/message.h>
10 #include <libpspp/i18n.h>
14 #include <data/settings.h>
19 /* Formats a value according to FORMAT
20 The returned string must be freed when no longer required */
22 value_to_text (union value v, struct fmt_spec format)
26 s = g_new (gchar, format.w + 1);
27 data_out (&v, &format, s);
37 text_to_value (const gchar *text, union value *v,
38 struct fmt_spec format)
42 if ( format.type != FMT_A)
44 if ( ! text ) return FALSE;
47 const gchar *s = text;
55 if ( !*s) return FALSE;
60 ok = data_in (ss_cstr (text), format.type, 0, 0,
61 v, fmt_var_width (&format));
69 get_widget_assert (GladeXML *xml, const gchar *name)
75 w = glade_xml_get_widget (xml, name);
78 g_warning ("Widget \"%s\" could not be found\n", name);
83 /* Converts a string in the pspp locale to utf-8 */
85 pspp_locale_to_utf8 (const gchar *text, gssize len, GError **err)
87 return recode_string (CONV_PSPP_TO_UTF8, text, len);
90 #define _(msgid) gettext (msgid)
91 #define N_(msgid) msgid
97 static struct msg m = {
105 m.text=g_strdup (_("Sorry. The help system hasn't yet been implemented."));
111 connect_help (GladeXML *xml)
113 GList *helps = glade_xml_get_widget_prefix (xml, "help_button_");
116 for ( i = g_list_first (helps); i ; i = g_list_next (i))
117 g_signal_connect (GTK_WIDGET (i->data), "clicked", give_help, 0);
123 reference_manual (GtkMenuItem *menu, gpointer data)
126 if ( ! g_spawn_command_line_async ("yelp info:pspp", &err) )
128 msg (ME, _("Cannot open reference manual: %s"), err->message);
130 g_clear_error (&err);