X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fvar-sheet.c;h=4358c78326e835e1d794c48808583241c2660f10;hb=2c71feac2da7abc2cd178b1ff30e0f217c3b6d86;hp=76065949829564e7e6ef4c39ca5267864e5d7e40;hpb=b1352e0bd746fd3ca70dafb1c1715deb70234a41;p=pspp-builds.git diff --git a/src/ui/gui/var-sheet.c b/src/ui/gui/var-sheet.c index 76065949..4358c783 100644 --- a/src/ui/gui/var-sheet.c +++ b/src/ui/gui/var-sheet.c @@ -22,6 +22,11 @@ /* This module creates the Variable Sheet used for inputing the variables in the dictonary */ +#include +#include +#define _(msgid) gettext (msgid) +#define N_(msgid) msgid + #include #include @@ -29,11 +34,10 @@ #include #include +#include #include -#include - #include #include #include @@ -50,8 +54,6 @@ #include "val-labs-dialog.h" #include "missing-val-dialog.h" -#define _(A) A -#define N_(A) A static const gint n_initial_rows = 40; @@ -66,16 +68,16 @@ struct column_parameters }; static const struct column_parameters column_def[] = { - {N_("Name"), 80}, - {N_("Type"), 100}, - {N_("Width"), 57}, - {N_("Decimals"),91}, - {N_("Label"), 95}, - {N_("Values"), 103}, - {N_("Missing"), 95}, - {N_("Columns"), 80}, - {N_("Align"), 69}, - {N_("Measure"), 99}, + { N_("Name"), 80}, + { N_("Type"), 100}, + { N_("Width"), 57}, + { N_("Decimals"),91}, + { N_("Label"), 95}, + { N_("Values"), 103}, + { N_("Missing"), 95}, + { N_("Columns"), 80}, + { N_("Align"), 69}, + { N_("Measure"), 99}, }; @@ -97,17 +99,17 @@ click2row(GtkWidget *w, gint row, gpointer data) -const gchar *alignments[]={ - _("Left"), - _("Right"), - _("Centre"), +const gchar *alignments[n_ALIGNMENTS + 1]={ + N_("Left"), + N_("Right"), + N_("Centre"), 0 }; -const gchar *measures[]={ - _("Nominal"), - _("Ordinal"), - _("Scale"), +const gchar *measures[n_MEASURES + 1]={ + N_("Nominal"), + N_("Ordinal"), + N_("Scale"), 0 }; @@ -126,7 +128,7 @@ create_label_list(const gchar **labels) { gtk_list_store_append (list_store, &iter); gtk_list_store_set (list_store, &iter, - 0, s, + 0, gettext(s), -1); } @@ -408,6 +410,8 @@ var_sheet_cell_change_entry (GtkSheet * sheet, gint row, gint column, } +extern PsppireVarStore *var_store; + /* Create the var sheet */ GtkWidget* @@ -416,15 +420,13 @@ psppire_variable_sheet_create (gchar *widget_name, gchar *string2, gint int1, gint int2) { + gchar *codeset; gint i; GtkWidget *sheet; GObject *geo = g_sheet_hetero_column_new(75, n_COLS); - GObject *row_geometry = g_sheet_uniform_row_new(25, n_initial_rows); - - - sheet = gtk_sheet_new(G_SHEET_ROW(row_geometry), + sheet = gtk_sheet_new(G_SHEET_ROW(var_store), G_SHEET_COLUMN(geo), "variable sheet", 0); @@ -444,14 +446,19 @@ psppire_variable_sheet_create (gchar *widget_name, GTK_SIGNAL_FUNC (click2row), sheet); + /* Since this happens inside glade_xml_new, we must prevent strings from + * being re-encoded twice */ + codeset = bind_textdomain_codeset(PACKAGE, 0); + bind_textdomain_codeset(PACKAGE, nl_langinfo(CODESET)); for (i = 0 ; i < n_COLS ; ++i ) { g_sheet_hetero_column_set_button_label(G_SHEET_HETERO_COLUMN(geo), i, - column_def[i].label); - + gettext(column_def[i].label)); + g_sheet_hetero_column_set_width(G_SHEET_HETERO_COLUMN(geo), i, column_def[i].width); } + bind_textdomain_codeset(PACKAGE, codeset); gtk_widget_show(sheet);