internationalised system files.
+Thu May 11 22:20:04 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * gtksheet.c, gtksheet.h: Fixed broken deallocation of sheet->pixmap.
+
Thu May 4 17:55:48 WST 2006 John Darrington <john@darrington.wattle.id.au>
* gtksheet.c: Added callback on inserted rows.
gdk_window_destroy (sheet->row_title_window);
if (sheet->pixmap){
- g_free (sheet->pixmap);
+ g_object_unref(sheet->pixmap);
sheet->pixmap = NULL;
}
&pixmap_width, &pixmap_height);
if ((pixmap_width != width) || (pixmap_height != height))
{
- g_free(sheet->pixmap);
+ g_object_unref(sheet->pixmap);
sheet->pixmap = gdk_pixmap_new (sheet->sheet_window,
width, height,
-1);
guint sheet_window_height;
/* sheet backing pixmap */
- GdkWindow *pixmap;
+ GdkPixmap *pixmap;
/* offsets for scrolling */
gint hoffset;
+Thu May 11 22:25:49 WST 2006 John Darrington <john@darrington.wattle.id.au>
+
+ * data-sheet.c helper.c helper.h psppire-data-store.c psppire-var-store.c
+ psppire.c: Converted strings to utf8 before passing to gtksheet.
+
+ * psppire-dict.c: Changed buffer to more reasonable length
+
+ * var-sheet.c: Changed maximum string length to use macro from
+ data/values.h
+
+
Sun May 7 10:07:28 WST 2006 John Darrington <john@darrington.wattle.id.au>
* psppire-data-store.c: Fixed buglet initialising string members.
psppire_dict_get_variable(data_store->dict, col);
gchar *text ;
+ gchar *s ;
if ( !xml)
return FALSE;
cell_ref_entry = GTK_ENTRY(get_widget_assert(xml, "cell_ref_entry"));
- gtk_entry_set_text(cell_ref_entry, text);
+ s = pspp_locale_to_utf8(text, -1, 0);
g_free(text);
+
+ gtk_entry_set_text(cell_ref_entry, s);
+
+ g_free(s);
}
return FALSE;
w = glade_xml_get_widget(xml, name);
if ( !w )
- g_warning("Widget \"%s\" could not be found\n",name);
+ g_warning("Widget \"%s\" could not be found\n", name);
return w;
}
+/* Converts a string in the pspp locale to utf-8 */
+const char *
+pspp_locale_to_utf8(const gchar *text, gssize len, GError **err)
+{
+ GError *tmp_error = 0;
+
+ const gchar *s;
+
+ if ( ! text )
+ return 0;
+
+ s = g_locale_to_utf8(text, len, 0, 0, &tmp_error);
+
+ if ( tmp_error)
+ {
+ g_warning("Error converting to UTF8: %s", tmp_error->message);
+ g_propagate_error (err, tmp_error);
+ }
+
+ return s;
+}
+
GtkWidget * get_widget_assert(GladeXML *xml, const gchar *name);
+/* Converts a string in the pspp locale to utf-8 */
+const char * pspp_locale_to_utf8(const gchar *text, gssize len, GError **err);
+
+
#endif
static const gchar *
psppire_data_store_get_string(GSheetModel *model, gint row, gint column)
{
-
+ const char *text;
const struct fmt_spec *fp ;
const struct PsppireVariable *pv ;
const union value *v ;
const gchar *label;
if ( (label = val_labs_find(vl, *v)) )
{
- return label;
+ return pspp_locale_to_utf8(label, -1, 0);
}
}
FP->W character in buffer S according to format specification
FP. No null terminator is appended to the buffer. */
data_out (s->str, fp, v);
+
- return g_string_free(s, FALSE);
-#if 0
- {
- static gchar buf[255];
- GError *err = NULL;
- gchar *text = g_locale_to_utf8(s, fp->w, 0, 0, &err);
- if ( !err )
- {
- g_snprintf(buf, 255, text);
- g_free(text);
- }
- else
- {
- g_warning("Cannot convert string \"%s\" to utf-8: %s\n", s, err->message);
- g_error_free(err);
- return NULL;
- }
+ text = pspp_locale_to_utf8(s->str, fp->w, 0);
+ g_string_free(s, TRUE);
- return buf ;
- }
-#endif
+ return text;
}
static const gchar *
geometry_get_button_label(const GSheetColumn *geom, gint unit)
{
+ const gchar *text;
struct PsppireVariable *pv ;
PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
- return null_var_name;
+ return pspp_locale_to_utf8(null_var_name, -1, 0);
pv = psppire_dict_get_variable(ds->dict, unit);
- return psppire_variable_get_name(pv);
+ text = pspp_locale_to_utf8(psppire_variable_get_name(pv), -1, 0);
+
+ return text;
}
auto_generate_var_name(PsppireDict *dict)
{
gint d = 0;
- static gchar name[255];
+ static gchar name[10];
- while (g_snprintf(name, 255, "VAR%05d",d++),
+ while (g_snprintf(name, 10, "VAR%05d",d++),
psppire_dict_lookup_var(dict, name))
;
s = text_for_column(pv, column);
- return g_locale_to_utf8(s, -1, 0,0,0);
+ return pspp_locale_to_utf8(s, -1, 0);
}
var_store = psppire_var_store_new(the_dictionary);
/* Create the model for the data sheet */
- the_cases = psppire_case_array_new(100, 20);
+ the_cases = psppire_case_array_new(100000, 20);
data_store = psppire_data_store_new(the_dictionary, the_cases);
#include <stdlib.h>
#include <string.h>
-#define min(A,B) ((A < B)?A:B)
+#include <data/value.h>
+
+#include <minmax.h>
#include <gtksheet/gtksheet.h>
#include <gtksheet/gsheet-hetero-column.h>
{
case COL_WIDTH:
r_min = fmt->d + 1;
- r_max = (psppire_variable_get_type(pv) == ALPHA) ? 255 : 40;
+ r_max = (psppire_variable_get_type(pv) == ALPHA) ? MAX_STRING : 40;
break;
case COL_DECIMALS:
r_min = 0 ;
- r_max = min(fmt->w - 1, 16);
+ r_max = MIN(fmt->w - 1, 16);
break;
case COL_COLUMNS:
r_min = 1;