X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fui%2Fgui%2Fpsppire-data-editor.c;h=26c375640580d527a0e435291f5a1b345c9b45f5;hb=bea8b007855970c07083dbec5b5cc90f33990957;hp=b5f22735cf64de54bf440370952b9084cdb43c26;hpb=d4ae90b2fe74d2d1427afad35d32c9e5584211ed;p=pspp diff --git a/src/ui/gui/psppire-data-editor.c b/src/ui/gui/psppire-data-editor.c index b5f22735cf..26c3756405 100644 --- a/src/ui/gui/psppire-data-editor.c +++ b/src/ui/gui/psppire-data-editor.c @@ -24,6 +24,7 @@ #include "data/datasheet.h" #include "data/value-labels.h" #include "libpspp/range-set.h" +#include "libpspp/str.h" #include "ui/gui/helper.h" #include "ui/gui/pspp-sheet-selection.h" #include "ui/gui/psppire-data-sheet.h" @@ -427,21 +428,21 @@ refresh_entry (PsppireDataEditor *de) } else { - GString *string; - - string = g_string_sized_new (25); - g_string_append_printf (string, - ngettext ("%'d case", "%'d cases", n_cases), - n_cases); - g_string_append_c (string, ' '); - g_string_append_unichar (string, 0xd7); /* U+00D7 MULTIPLICATION SIGN */ - g_string_append_c (string, ' '); - g_string_append_printf (string, - ngettext ("%'d variable", "%'d variables", - n_vars), - n_vars); - ref_cell_text = string->str; - g_string_free (string, FALSE); + struct string s; + + /* The glib string library does not understand the ' printf modifier + on all platforms, but the "struct string" library does (because + Gnulib fixes that problem), so use the latter. */ + ds_init_empty (&s); + ds_put_format (&s, ngettext ("%'d case", "%'d cases", n_cases), + n_cases); + ds_put_byte (&s, ' '); + ds_put_unichar (&s, 0xd7); /* U+00D7 MULTIPLICATION SIGN */ + ds_put_byte (&s, ' '); + ds_put_format (&s, ngettext ("%'d variable", "%'d variables", + n_vars), + n_vars); + ref_cell_text = ds_steal_cstr (&s); } psppire_value_entry_set_variable (PSPPIRE_VALUE_ENTRY (de->datum_entry), @@ -695,6 +696,7 @@ psppire_data_editor_init (PsppireDataEditor *de) de->font = NULL; de->ui_manager = NULL; + de->old_vbox_widget = NULL; g_object_set (de, "tab-pos", GTK_POS_BOTTOM, NULL); @@ -813,12 +815,20 @@ psppire_data_editor_split_window (PsppireDataEditor *de, gboolean split) PSPP_SHEET_VIEW (de->data_sheets[0])); disconnect_data_sheets (de); - gtk_widget_destroy (de->datasheet_vbox_widget); + if (de->old_vbox_widget) + g_object_unref (de->old_vbox_widget); + de->old_vbox_widget = de->datasheet_vbox_widget; + g_object_ref (de->old_vbox_widget); + /* FIXME: old_vbox_widget needs to be unreffed in dispose. + (currently it seems to provoke an error if I do that. + I don't know why. */ + gtk_container_remove (GTK_CONTAINER (de->vbox), de->datasheet_vbox_widget); if (split) de->datasheet_vbox_widget = make_split_datasheet (de, grid_lines); else de->datasheet_vbox_widget = make_single_datasheet (de, grid_lines); + psppire_data_editor_refresh_model (de); gtk_box_pack_start (GTK_BOX (de->vbox), de->datasheet_vbox_widget,