[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp lib/gtksheet/ChangeLog lib/gtksheet/gtkshe...
From: |
John Darrington |
Subject: |
[Pspp-cvs] pspp lib/gtksheet/ChangeLog lib/gtksheet/gtkshe... |
Date: |
Thu, 11 May 2006 14:28:03 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Branch:
Changes by: John Darrington <address@hidden> 06/05/11 14:28:03
Modified files:
lib/gtksheet : ChangeLog gtksheet.c gtksheet.h
src/ui/gui : ChangeLog data-sheet.c helper.c helper.h
psppire-data-store.c psppire-dict.c
psppire-var-store.c psppire.c var-sheet.c
Log message:
Converted strings to utf8 before passing to gtksheet. Should work
properly now with
internationalised system files.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/lib/gtksheet/ChangeLog.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/lib/gtksheet/gtksheet.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/lib/gtksheet/gtksheet.h.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/ChangeLog.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/data-sheet.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/helper.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/helper.h.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/psppire-data-store.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/psppire-dict.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/psppire-var-store.c.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/psppire.c.diff?tr1=1.6&tr2=1.7&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/pspp/pspp/src/ui/gui/var-sheet.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
Patches:
Index: pspp/lib/gtksheet/ChangeLog
diff -u pspp/lib/gtksheet/ChangeLog:1.2 pspp/lib/gtksheet/ChangeLog:1.3
--- pspp/lib/gtksheet/ChangeLog:1.2 Thu May 4 10:09:31 2006
+++ pspp/lib/gtksheet/ChangeLog Thu May 11 14:28:02 2006
@@ -1,3 +1,7 @@
+Thu May 11 22:20:04 WST 2006 John Darrington <address@hidden>
+
+ * gtksheet.c, gtksheet.h: Fixed broken deallocation of sheet->pixmap.
+
Thu May 4 17:55:48 WST 2006 John Darrington <address@hidden>
* gtksheet.c: Added callback on inserted rows.
Index: pspp/lib/gtksheet/gtksheet.c
diff -u pspp/lib/gtksheet/gtksheet.c:1.3 pspp/lib/gtksheet/gtksheet.c:1.4
--- pspp/lib/gtksheet/gtksheet.c:1.3 Thu May 4 10:09:31 2006
+++ pspp/lib/gtksheet/gtksheet.c Thu May 11 14:28:02 2006
@@ -2782,7 +2782,7 @@
gdk_window_destroy (sheet->row_title_window);
if (sheet->pixmap){
- g_free (sheet->pixmap);
+ g_object_unref(sheet->pixmap);
sheet->pixmap = NULL;
}
@@ -4134,7 +4134,7 @@
&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);
Index: pspp/lib/gtksheet/gtksheet.h
diff -u pspp/lib/gtksheet/gtksheet.h:1.1 pspp/lib/gtksheet/gtksheet.h:1.2
--- pspp/lib/gtksheet/gtksheet.h:1.1 Sat Mar 4 01:11:56 2006
+++ pspp/lib/gtksheet/gtksheet.h Thu May 11 14:28:02 2006
@@ -178,7 +178,7 @@
guint sheet_window_height;
/* sheet backing pixmap */
- GdkWindow *pixmap;
+ GdkPixmap *pixmap;
/* offsets for scrolling */
gint hoffset;
Index: pspp/src/ui/gui/ChangeLog
diff -u pspp/src/ui/gui/ChangeLog:1.10 pspp/src/ui/gui/ChangeLog:1.11
--- pspp/src/ui/gui/ChangeLog:1.10 Sun May 7 02:18:32 2006
+++ pspp/src/ui/gui/ChangeLog Thu May 11 14:28:03 2006
@@ -1,3 +1,14 @@
+Thu May 11 22:25:49 WST 2006 John Darrington <address@hidden>
+
+ * 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 <address@hidden>
* psppire-data-store.c: Fixed buglet initialising string members.
Index: pspp/src/ui/gui/data-sheet.c
diff -u pspp/src/ui/gui/data-sheet.c:1.3 pspp/src/ui/gui/data-sheet.c:1.4
--- pspp/src/ui/gui/data-sheet.c:1.3 Tue Apr 4 12:43:22 2006
+++ pspp/src/ui/gui/data-sheet.c Thu May 11 14:28:03 2006
@@ -98,6 +98,7 @@
psppire_dict_get_variable(data_store->dict, col);
gchar *text ;
+ gchar *s ;
if ( !xml)
return FALSE;
@@ -107,9 +108,13 @@
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;
Index: pspp/src/ui/gui/helper.c
diff -u pspp/src/ui/gui/helper.c:1.3 pspp/src/ui/gui/helper.c:1.4
--- pspp/src/ui/gui/helper.c:1.3 Tue Apr 4 12:43:22 2006
+++ pspp/src/ui/gui/helper.c Thu May 11 14:28:03 2006
@@ -71,8 +71,30 @@
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;
+}
+
Index: pspp/src/ui/gui/helper.h
diff -u pspp/src/ui/gui/helper.h:1.2 pspp/src/ui/gui/helper.h:1.3
--- pspp/src/ui/gui/helper.h:1.2 Wed Mar 15 03:29:11 2006
+++ pspp/src/ui/gui/helper.h Thu May 11 14:28:03 2006
@@ -38,4 +38,8 @@
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
Index: pspp/src/ui/gui/psppire-data-store.c
diff -u pspp/src/ui/gui/psppire-data-store.c:1.6
pspp/src/ui/gui/psppire-data-store.c:1.7
--- pspp/src/ui/gui/psppire-data-store.c:1.6 Sun May 7 10:11:51 2006
+++ pspp/src/ui/gui/psppire-data-store.c Thu May 11 14:28:03 2006
@@ -329,7 +329,7 @@
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 ;
@@ -358,7 +358,7 @@
const gchar *label;
if ( (label = val_labs_find(vl, *v)) )
{
- return label;
+ return pspp_locale_to_utf8(label, -1, 0);
}
}
@@ -375,28 +375,12 @@
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;
}
@@ -658,15 +642,18 @@
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;
}
Index: pspp/src/ui/gui/psppire-dict.c
diff -u pspp/src/ui/gui/psppire-dict.c:1.3 pspp/src/ui/gui/psppire-dict.c:1.4
--- pspp/src/ui/gui/psppire-dict.c:1.3 Tue Apr 4 12:43:22 2006
+++ pspp/src/ui/gui/psppire-dict.c Thu May 11 14:28:03 2006
@@ -212,10 +212,10 @@
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))
;
Index: pspp/src/ui/gui/psppire-var-store.c
diff -u pspp/src/ui/gui/psppire-var-store.c:1.4
pspp/src/ui/gui/psppire-var-store.c:1.5
--- pspp/src/ui/gui/psppire-var-store.c:1.4 Sun May 7 10:11:51 2006
+++ pspp/src/ui/gui/psppire-var-store.c Thu May 11 14:28:03 2006
@@ -312,7 +312,7 @@
s = text_for_column(pv, column);
- return g_locale_to_utf8(s, -1, 0,0,0);
+ return pspp_locale_to_utf8(s, -1, 0);
}
Index: pspp/src/ui/gui/psppire.c
diff -u pspp/src/ui/gui/psppire.c:1.6 pspp/src/ui/gui/psppire.c:1.7
--- pspp/src/ui/gui/psppire.c:1.6 Thu May 4 10:09:32 2006
+++ pspp/src/ui/gui/psppire.c Thu May 11 14:28:03 2006
@@ -78,7 +78,7 @@
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);
Index: pspp/src/ui/gui/var-sheet.c
diff -u pspp/src/ui/gui/var-sheet.c:1.3 pspp/src/ui/gui/var-sheet.c:1.4
--- pspp/src/ui/gui/var-sheet.c:1.3 Tue Apr 4 12:43:22 2006
+++ pspp/src/ui/gui/var-sheet.c Thu May 11 14:28:03 2006
@@ -30,7 +30,9 @@
#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>
@@ -366,11 +368,11 @@
{
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;