Re-enabled automatic insertion of cases in data sheet.
[pspp-builds.git] / src / ui / gui / psppire-data-store.c
1 /* psppire-data-store.c
2  
3    PSPPIRE --- A Graphical User Interface for PSPP
4    Copyright (C) 2006  Free Software Foundation
5    Written by John Darrington
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    You should have received a copy of the GNU General Public License
18    along with this program; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20    02110-1301, USA. */
21
22 #include <config.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include <gettext.h>
26 #define _(msgid) gettext(msgid)
27 #define N_(msgid) msgid
28
29 #include <data/casefile.h>
30 #include <data/case.h>
31
32 #include <gtksheet/gtksheet.h>
33 #include <gtksheet/gsheetmodel.h>
34 #include <gtksheet/gsheet-column-iface.h>
35
36 #include <pango/pango-context.h>
37
38 #include "psppire-variable.h"
39 #include "psppire-data-store.h"
40 #include "psppire-case-file.h"
41 #include "helper.h"
42
43 #include <data/dictionary.h>
44 #include <data/missing-values.h>
45 #include <data/value-labels.h>
46 #include <data/data-in.h>
47
48 #include <data/file-handle-def.h>
49 #include <data/sys-file-writer.h>
50
51
52
53 static void psppire_data_store_init            (PsppireDataStore      *data_store);
54 static void psppire_data_store_class_init      (PsppireDataStoreClass *class);
55 static void psppire_data_store_sheet_model_init (GSheetModelIface *iface);
56 static void psppire_data_store_sheet_column_init (GSheetColumnIface *iface);
57 static void psppire_data_store_sheet_row_init (GSheetRowIface *iface);
58
59 static void psppire_data_store_finalize        (GObject           *object);
60
61 static gchar *psppire_data_store_get_string(const GSheetModel *sheet_model, gint row, gint column);
62
63 static gboolean psppire_data_store_set_string(GSheetModel *model, 
64                                           const gchar *text, gint row, gint column);
65
66 static gboolean psppire_data_store_clear_datum(GSheetModel *model, 
67                                           gint row, gint column);
68
69
70 #define MIN_COLUMNS 10
71
72 #define TRAILING_ROWS 10
73
74 static GObjectClass *parent_class = NULL;
75
76
77 enum  {FONT_CHANGED,
78        n_SIGNALS};
79
80 static guint signal[n_SIGNALS];
81
82
83 inline GType
84 psppire_data_store_get_type (void)
85 {
86   static GType data_store_type = 0;
87
88   if (!data_store_type)
89     {
90       static const GTypeInfo data_store_info =
91       {
92         sizeof (PsppireDataStoreClass),
93         NULL,           /* base_init */
94         NULL,           /* base_finalize */
95         (GClassInitFunc) psppire_data_store_class_init,
96         NULL,           /* class_finalize */
97         NULL,           /* class_data */
98         sizeof (PsppireDataStore),
99         0,
100         (GInstanceInitFunc) psppire_data_store_init,
101       };
102
103       static const GInterfaceInfo sheet_model_info =
104       {
105         (GInterfaceInitFunc) psppire_data_store_sheet_model_init,
106         NULL,
107         NULL
108       };
109
110       static const GInterfaceInfo sheet_column_info =
111       {
112         (GInterfaceInitFunc) psppire_data_store_sheet_column_init,
113         NULL,
114         NULL
115       };
116
117       static const GInterfaceInfo sheet_row_info =
118       {
119         (GInterfaceInitFunc) psppire_data_store_sheet_row_init,
120         NULL,
121         NULL
122       };
123
124
125       data_store_type = g_type_register_static (G_TYPE_OBJECT, "PsppireDataStore",
126                                                 &data_store_info, 0);
127
128       g_type_add_interface_static (data_store_type,
129                                    G_TYPE_SHEET_MODEL,
130                                    &sheet_model_info);
131
132       g_type_add_interface_static (data_store_type,
133                                    G_TYPE_SHEET_COLUMN,
134                                    &sheet_column_info);
135
136       g_type_add_interface_static (data_store_type,
137                                    G_TYPE_SHEET_ROW,
138                                    &sheet_row_info);
139     }
140
141   return data_store_type;
142 }
143
144
145 static void
146 psppire_data_store_class_init (PsppireDataStoreClass *class)
147 {
148   GObjectClass *object_class;
149
150   parent_class = g_type_class_peek_parent (class);
151   object_class = (GObjectClass*) class;
152
153   object_class->finalize = psppire_data_store_finalize;
154
155   signal[FONT_CHANGED] =
156     g_signal_new ("font_changed",
157                   G_TYPE_FROM_CLASS(class),
158                   G_SIGNAL_RUN_FIRST,
159                   0,
160                   NULL, NULL,
161                   g_cclosure_marshal_VOID__VOID,
162                   G_TYPE_NONE, 
163                   0);
164 }
165
166
167
168 static gint
169 psppire_data_store_get_var_count (const GSheetModel *model)
170 {
171   const PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
172   
173   return psppire_dict_get_var_cnt(store->dict);
174 }
175
176 static gint
177 psppire_data_store_get_case_count (const GSheetModel *model)
178 {
179   const PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
180
181   return psppire_case_file_get_case_count(store->case_file);
182 }
183
184
185 static void
186 psppire_data_store_init (PsppireDataStore *data_store)
187 {
188   data_store->dict = 0;
189   data_store->case_file = 0;
190   data_store->width_of_m = 10;
191 }
192
193 const PangoFontDescription *
194 psppire_data_store_get_font_desc(const GSheetModel *model,
195                               gint row, gint column)
196 {
197   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
198   
199   return store->font_desc;
200 }
201
202
203 static void
204 psppire_data_store_sheet_model_init (GSheetModelIface *iface)
205 {
206   iface->free_strings = TRUE;
207   iface->get_string = psppire_data_store_get_string;
208   iface->set_string = psppire_data_store_set_string;
209   iface->clear_datum = psppire_data_store_clear_datum;
210   iface->is_editable = NULL;
211   iface->is_visible = NULL;
212   iface->get_foreground = NULL;
213   iface->get_background = NULL;
214   iface->get_font_desc = psppire_data_store_get_font_desc;
215   iface->get_cell_border = NULL;
216   iface->get_column_count = psppire_data_store_get_var_count;
217   iface->get_row_count = psppire_data_store_get_case_count;
218 }
219
220 static
221 gboolean always_true()
222 {
223   return TRUE;
224 }
225
226
227 static void
228 delete_cases_callback(GtkWidget *w, gint first, gint n_cases, gpointer data)
229 {
230   PsppireDataStore *store  ;
231
232   g_return_if_fail (data);
233
234   store  = PSPPIRE_DATA_STORE(data);
235
236   g_assert(first >= 0);
237
238   g_sheet_model_rows_deleted (G_SHEET_MODEL(store), first, n_cases);
239 }
240
241
242 static void
243 insert_case_callback(GtkWidget *w, gint casenum, gpointer data)
244 {
245   PsppireDataStore *store  ;
246
247   g_return_if_fail (data);
248
249   store  = PSPPIRE_DATA_STORE(data);
250   
251   g_sheet_model_range_changed (G_SHEET_MODEL(store),
252                                casenum, -1,
253                                psppire_case_file_get_case_count(store->case_file),
254                                -1);
255
256   g_sheet_model_rows_inserted (G_SHEET_MODEL(store), casenum, 1);
257 }
258
259
260 static void
261 changed_case_callback(GtkWidget *w, gint casenum, gpointer data)
262 {
263   PsppireDataStore *store  ;
264   g_return_if_fail (data);
265
266   store  = PSPPIRE_DATA_STORE(data);
267   
268   g_sheet_model_range_changed (G_SHEET_MODEL(store),
269                                  casenum, -1,
270                                  casenum, -1);
271 }
272
273
274 static void
275 delete_variables_callback(GObject *obj, gint var_num, gint n_vars, gpointer data)
276 {
277   PsppireDataStore *store ;
278
279   g_return_if_fail (data);
280
281   store  = PSPPIRE_DATA_STORE(data);
282
283   g_sheet_model_columns_deleted (G_SHEET_MODEL(store), var_num, n_vars);
284
285   g_sheet_column_columns_changed(G_SHEET_COLUMN(store),
286                                    var_num, -1);
287 }
288
289 static void
290 insert_variable_callback(GObject *obj, gint var_num, gpointer data)
291 {
292   PsppireDataStore *store;
293   gint posn;
294
295   g_return_if_fail (data);
296
297   store  = PSPPIRE_DATA_STORE(data);
298   
299   if ( var_num > 0 ) 
300     {
301       struct PsppireVariable *variable;
302       variable = psppire_dict_get_variable(store->dict, var_num);
303
304       posn = psppire_variable_get_fv(variable);
305     }
306   else
307     {
308       posn = 0;
309     }
310
311   psppire_case_file_insert_values(store->case_file, 1, posn);
312
313   g_sheet_column_columns_changed(G_SHEET_COLUMN(store),
314                                   var_num, 1);
315
316   g_sheet_model_columns_inserted (G_SHEET_MODEL(store), var_num, 1);
317 }
318
319
320 static void
321 dict_size_change_callback(GObject *obj, 
322                           gint posn, gint adjustment, gpointer data)
323 {
324   PsppireDataStore *store ;
325
326   g_return_if_fail (data);
327
328   store  = PSPPIRE_DATA_STORE(data);
329
330   psppire_case_file_insert_values (store->case_file, adjustment, posn);
331 }
332
333
334
335 /**
336  * psppire_data_store_new:
337  * @dict: The dictionary for this data_store.
338  *
339  *
340  * Return value: a new #PsppireDataStore
341  **/
342 PsppireDataStore *
343 psppire_data_store_new (PsppireDict *dict)
344 {
345   PsppireDataStore *retval;
346
347   retval = g_object_new (GTK_TYPE_DATA_STORE, NULL);
348
349   psppire_data_store_set_dictionary(retval, dict);
350
351
352   return retval;
353 }
354
355
356
357 /**
358  * psppire_data_store_replace_set_dictionary:
359  * @data_store: The variable store
360  * @dict: The dictionary to set
361  *
362  * If a dictionary is already associated with the data-store, then it will be
363  * destroyed.
364  **/
365 void
366 psppire_data_store_set_dictionary(PsppireDataStore *data_store, PsppireDict *dict)
367 {
368   gint var_cnt = psppire_dict_get_next_value_idx(dict);
369 #if 0
370   if ( data_store->dict ) g_object_unref(data_store->dict);
371 #endif
372
373   data_store->dict = dict;
374
375   if ( data_store->case_file)
376     {
377       g_object_unref(data_store->case_file);
378       data_store->case_file = 0;
379     }
380
381   data_store->case_file = psppire_case_file_new(var_cnt);
382
383   g_signal_connect(data_store->case_file, "cases-deleted", 
384                    G_CALLBACK(delete_cases_callback), 
385                    data_store);
386
387   g_signal_connect(data_store->case_file, "case-inserted", 
388                    G_CALLBACK(insert_case_callback), 
389                    data_store);
390
391
392   g_signal_connect(data_store->case_file, "case-changed", 
393                    G_CALLBACK(changed_case_callback), 
394                    data_store);
395
396   g_signal_connect(dict, "variable-inserted", 
397                    G_CALLBACK(insert_variable_callback), 
398                    data_store);
399
400   g_signal_connect(dict, "variables-deleted", 
401                    G_CALLBACK(delete_variables_callback), 
402                    data_store);
403
404   g_signal_connect (dict, "dict-size-changed", 
405                     G_CALLBACK(dict_size_change_callback),
406                     data_store);
407
408   /* The entire model has changed */
409   g_sheet_model_range_changed (G_SHEET_MODEL(data_store), -1, -1, -1, -1);
410   
411   g_sheet_column_columns_changed(G_SHEET_COLUMN(data_store), 0, -1);
412 }
413
414 static void
415 psppire_data_store_finalize (GObject *object)
416 {
417
418   /* must chain up */
419   (* parent_class->finalize) (object);
420 }
421
422
423
424 /* Insert a blank case before POSN */
425 gboolean
426 psppire_data_store_insert_new_case(PsppireDataStore *ds, gint posn)
427 {
428   gboolean result;
429   gint val_cnt, v; 
430   struct ccase cc;
431   g_return_val_if_fail (ds, FALSE);
432
433
434   /* Opportunity for optimisation exists here when creating a blank case */
435   val_cnt = casefile_get_value_cnt(ds->case_file->flexifile) ;
436   
437   case_create (&cc, val_cnt);
438
439   memset ( case_data_rw (&cc, 0), 0, val_cnt * MAX_SHORT_STRING);
440
441   for (v = 0 ; v < psppire_dict_get_var_cnt (ds->dict) ; ++v) 
442     {
443       const struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, v);
444       if (ALPHA ==  psppire_variable_get_type(pv) ) 
445         continue;
446
447       case_data_rw (&cc, psppire_variable_get_fv (pv))->f = SYSMIS;
448     }
449
450   result = psppire_case_file_insert_case (ds->case_file, &cc, posn);
451
452   case_destroy (&cc);
453
454   return result;
455 }
456
457
458 static gchar *
459 psppire_data_store_get_string (const GSheetModel *model, gint row, gint column)
460 {
461   gint idx;
462   char *text;
463   const struct fmt_spec *fp ;
464   const struct PsppireVariable *pv ;
465   const union value *v ;
466   GString *s;
467   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
468
469   g_return_val_if_fail (store->dict, NULL);
470   g_return_val_if_fail (store->case_file, NULL);
471
472   if (column >= psppire_dict_get_var_cnt (store->dict))
473     return NULL;
474
475   if ( row >= psppire_case_file_get_case_count (store->case_file))
476     return NULL;
477
478   pv = psppire_dict_get_variable (store->dict, column);
479
480   idx = psppire_variable_get_fv (pv);
481
482   v = psppire_case_file_get_value (store->case_file, row, idx);
483
484   g_return_val_if_fail(v, NULL);
485
486   if ( store->show_labels) 
487     {
488       const struct val_labs * vl = psppire_variable_get_value_labels (pv);
489
490       const gchar *label;
491       if ( (label = val_labs_find(vl, *v)) )
492         {
493           return pspp_locale_to_utf8(label, -1, 0);
494         }
495     }
496
497   fp = psppire_variable_get_write_spec (pv);
498
499   s = g_string_sized_new (fp->w + 1);
500   g_string_set_size (s, fp->w);
501   
502   memset (s->str, 0, fp->w);
503
504   g_assert (fp->w == s->len);
505     
506   /* Converts binary value V into printable form in the exactly
507      FP->W character in buffer S according to format specification
508      FP.  No null terminator is appended to the buffer.  */
509   data_out (s->str, fp, v);
510
511   text = pspp_locale_to_utf8 (s->str, fp->w, 0);
512   g_string_free (s, TRUE);
513
514   g_strchomp (text);
515
516   return text;
517 }
518
519
520 static gboolean 
521 psppire_data_store_clear_datum (GSheetModel *model, 
522                                           gint row, gint col)
523
524 {
525   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
526
527   union value v;
528   const struct PsppireVariable *pv = psppire_dict_get_variable(store->dict, col);
529
530   const gint index = psppire_variable_get_fv(pv) ;
531
532   if ( psppire_variable_get_type(pv) == NUMERIC) 
533     v.f = SYSMIS;
534   else
535     memcpy(v.s, "", MAX_SHORT_STRING);
536
537   psppire_case_file_set_value(store->case_file, row, index, &v, 
538                               psppire_variable_get_width(pv));
539   return TRUE;
540 }
541
542
543 /* Attempts to update that part of the variable store which corresponds 
544    to ROW, COL with  the value TEXT.
545    Returns true if anything was updated, false otherwise.
546 */
547 static gboolean 
548 psppire_data_store_set_string(GSheetModel *model, 
549                           const gchar *text, gint row, gint col)
550 {
551   PsppireDataStore *store = PSPPIRE_DATA_STORE(model);
552
553   const struct PsppireVariable *pv = psppire_dict_get_variable(store->dict, col);
554   g_return_val_if_fail(pv, FALSE);
555
556 #if 0
557   /* Allow the user to insert a lot of blank cases, simply by skipping rows */
558   for(r = psppire_case_file_get_case_count(store->case_file); r <= row ; ++r) 
559     {
560
561       gint c;
562
563       psppire_case_array_insert_case(store->cases, r, 0, 0);
564
565
566       for (c = 0 ; c < psppire_dict_get_var_cnt(store->dict); ++c ) 
567         psppire_data_store_clear_datum(model, r, c);
568     }
569 #endif
570
571   {
572     const gint index = psppire_variable_get_fv(pv);
573
574     struct data_in d_in;
575     d_in.s = text;
576     d_in.e = text + strlen(text);
577     d_in.v = 0;
578     d_in.f1 = d_in.f2 = 0;
579     d_in.format = * psppire_variable_get_write_spec(pv);
580     d_in.flags = 0;
581
582     psppire_case_file_data_in(store->case_file, row, index, &d_in) ;
583   }
584
585   return TRUE;
586 }
587
588
589 void
590 psppire_data_store_set_font(PsppireDataStore *store, 
591                             const PangoFontDescription *fd)
592 {
593   g_return_if_fail (store);
594   g_return_if_fail (PSPPIRE_IS_DATA_STORE (store));
595
596   store->font_desc = fd;
597 #if 0
598   store->width_of_m = calc_m_width(fd);
599 #endif
600   g_signal_emit(store, signal[FONT_CHANGED], 0);  
601
602
603   g_sheet_model_range_changed (G_SHEET_MODEL(store),
604                                  -1, -1, -1, -1);
605 }
606
607
608 void
609 psppire_data_store_show_labels(PsppireDataStore *store, gboolean show_labels)
610 {
611   g_return_if_fail (store);
612   g_return_if_fail (PSPPIRE_IS_DATA_STORE (store));
613
614   store->show_labels = show_labels;
615
616   g_sheet_model_range_changed (G_SHEET_MODEL(store),
617                                  -1, -1, -1, -1);
618 }
619
620
621
622 /* FIXME: There's no reason to actually have this function.
623    It should be done by a procedure */
624 void
625 psppire_data_store_create_system_file(PsppireDataStore *store,
626                               struct file_handle *handle)
627 {
628   gint i, var_cnt;
629   const struct sfm_write_options wo = {
630     true, /* writeable */
631     false, /* dont compress */
632     3 /* version */
633   }; 
634
635   struct sfm_writer *writer ;
636
637   g_assert(handle);
638
639   writer = sfm_open_writer(handle, store->dict->dict, wo);
640
641   if ( ! writer) 
642     return;
643
644
645   var_cnt = psppire_data_store_get_var_count (G_SHEET_MODEL(store));
646
647   for (i = 0 ; i < psppire_case_file_get_case_count(store->case_file); ++i ) 
648     {
649       struct ccase c;
650       
651       case_create (&c, var_cnt);
652       psppire_case_file_get_case (store->case_file, i, &c);
653       sfm_write_case (writer, &c);
654
655       case_destroy (&c);
656     }
657
658   sfm_close_writer(writer);
659 }
660
661
662
663 void 
664 psppire_data_store_clear(PsppireDataStore *data_store)
665 {
666   psppire_case_file_clear(data_store->case_file);
667
668   psppire_dict_clear(data_store->dict);
669 }
670
671
672
673
674 /* Column related funcs */
675
676 static gint
677 geometry_get_column_count(const GSheetColumn *geom)
678 {
679   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
680
681   return MAX(MIN_COLUMNS, psppire_dict_get_var_cnt(ds->dict));
682 }
683
684
685
686 static gint
687 geometry_get_width(const GSheetColumn *geom, gint unit)
688 {
689   const struct PsppireVariable *pv ;
690   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
691
692   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
693     return ds->width_of_m * 8 ;
694
695   pv = psppire_dict_get_variable(ds->dict, unit);
696
697   if ( pv == NULL ) 
698     return ds->width_of_m * 8 ;
699
700   return ds->width_of_m * psppire_variable_get_columns(pv);
701 }
702
703 static void
704 geometry_set_width(GSheetColumn *geom, gint unit, gint width)
705 {
706   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
707
708   struct PsppireVariable *pv = psppire_dict_get_variable(ds->dict, unit);
709
710   psppire_variable_set_columns(pv, width / ds->width_of_m );
711 }
712
713
714
715 static GtkJustification
716 geometry_get_justification(const GSheetColumn *geom, gint unit)
717 {
718   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
719   const struct PsppireVariable *pv ;
720
721
722   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
723     return GTK_JUSTIFY_LEFT;
724
725   pv = psppire_dict_get_variable(ds->dict, unit);
726
727   /* Kludge: Happily GtkJustification is defined similarly
728      to enum alignment from pspp/variable.h */
729   return psppire_variable_get_alignment(pv);
730 }
731
732
733 static const gchar null_var_name[]=N_("var");
734  
735 static gchar *
736 geometry_get_column_button_label(const GSheetColumn *geom, gint unit)
737 {
738   gchar *text;
739   struct PsppireVariable *pv ;
740   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
741
742   if ( unit >= psppire_dict_get_var_cnt(ds->dict) )
743     return g_locale_to_utf8(null_var_name, -1, 0, 0, 0);
744
745   pv = psppire_dict_get_variable(ds->dict, unit);
746
747   text =  pspp_locale_to_utf8(psppire_variable_get_name(pv), -1, 0);
748
749   return text;
750 }
751
752
753 static gboolean
754 geometry_get_sensitivity(const GSheetColumn *geom, gint unit)
755 {
756   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
757
758   return (unit < psppire_dict_get_var_cnt(ds->dict));
759 }
760
761
762 static void
763 psppire_data_store_sheet_column_init (GSheetColumnIface *iface)
764 {
765   iface->get_column_count = geometry_get_column_count;
766   iface->get_width = geometry_get_width;
767   iface->set_width = geometry_set_width;
768   iface->get_visibility = always_true;
769   iface->get_sensitivity = geometry_get_sensitivity;
770   iface->get_justification = geometry_get_justification;
771   iface->get_button_label = geometry_get_column_button_label;
772 }
773
774
775 /* Row related funcs */
776
777 static gint
778 geometry_get_row_count(const GSheetRow *geom, gpointer data)
779 {
780   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
781
782   return TRAILING_ROWS + psppire_case_file_get_case_count(ds->case_file);
783 }
784
785
786 static gint
787 geometry_get_height(const GSheetRow *geom, gint unit, gpointer data)
788 {
789   return 25;
790 }
791
792
793 static gboolean
794 geometry_get_row_sensitivity(const GSheetRow *geom, gint unit, gpointer data)
795 {
796   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
797
798   
799   return (unit < psppire_case_file_get_case_count(ds->case_file));
800 }
801
802
803 static gchar *
804 geometry_get_row_button_label(const GSheetRow *geom, gint unit, gpointer data)
805 {
806   gchar *text;
807   gchar *s;
808   PsppireDataStore *ds = PSPPIRE_DATA_STORE(geom);
809
810   if ( unit > 
811        TRAILING_ROWS + psppire_case_file_get_case_count(ds->case_file))
812     return 0;
813
814   s = g_strdup_printf(_("%d"), unit);
815
816   text =  pspp_locale_to_utf8(s, -1, 0);
817   
818   g_free(s);
819   
820   return text;
821 }
822
823
824 static void
825 psppire_data_store_sheet_row_init (GSheetRowIface *iface)
826 {
827   iface->get_row_count = geometry_get_row_count;
828
829   iface->get_height = geometry_get_height;
830   iface->set_height = 0;
831   iface->get_visibility = always_true;
832   iface->get_sensitivity = geometry_get_row_sensitivity;
833
834   iface->get_button_label = geometry_get_row_button_label;
835 }