[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pspp-cvs] pspp/src/ui/gui psppire-case-file.c psppire-cas...
From: |
John Darrington |
Subject: |
[Pspp-cvs] pspp/src/ui/gui psppire-case-file.c psppire-cas... |
Date: |
Tue, 12 Jun 2007 01:59:01 +0000 |
CVSROOT: /sources/pspp
Module name: pspp
Changes by: John Darrington <jmd> 07/06/12 01:59:01
Modified files:
src/ui/gui : psppire-case-file.c psppire-case-file.h
psppire-data-store.c psppire-data-store.h
psppire.c
Log message:
Improved the encapsulation of PsppireCaseFile
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-case-file.c?cvsroot=pspp&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-case-file.h?cvsroot=pspp&r1=1.12&r2=1.13
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.c?cvsroot=pspp&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire-data-store.h?cvsroot=pspp&r1=1.8&r2=1.9
http://cvs.savannah.gnu.org/viewcvs/pspp/src/ui/gui/psppire.c?cvsroot=pspp&r1=1.42&r2=1.43
Patches:
Index: psppire-case-file.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-case-file.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- psppire-case-file.c 8 Jun 2007 04:54:02 -0000 1.19
+++ psppire-case-file.c 12 Jun 2007 01:59:00 -0000 1.20
@@ -133,6 +133,7 @@
{
PsppireCaseFile *cf = PSPPIRE_CASE_FILE (object);
+ if ( cf->accessible)
datasheet_destroy (cf->datasheet);
G_OBJECT_CLASS (parent_class)->finalize (object);
@@ -142,6 +143,7 @@
psppire_case_file_init (PsppireCaseFile *cf)
{
cf->datasheet = NULL;
+ cf->accessible = FALSE;
}
@@ -152,24 +154,17 @@
* Creates a new #PsppireCaseFile.
*/
PsppireCaseFile*
-psppire_case_file_new (void)
+psppire_case_file_new (struct casereader *reader)
{
PsppireCaseFile *cf = g_object_new (G_TYPE_PSPPIRE_CASE_FILE, NULL);
- cf->datasheet = datasheet_create (NULL);
+ cf->datasheet = datasheet_create (reader);
+ cf->accessible = TRUE;
return cf;
}
-void
-psppire_case_file_replace_datasheet (PsppireCaseFile *cf, struct datasheet *ds)
-{
- cf->datasheet = ds;
-}
-
-
-
gboolean
psppire_case_file_delete_cases (PsppireCaseFile *cf, gint n_cases, gint first)
{
@@ -234,6 +229,7 @@
psppire_case_file_get_case_count (const PsppireCaseFile *cf)
{
g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->accessible, FALSE);
if ( ! cf->datasheet)
return 0;
@@ -354,6 +350,7 @@
{
union value *values;
g_return_val_if_fail (cf, FALSE);
+ g_return_val_if_fail (cf->accessible, FALSE);
if ( ! cf->datasheet )
cf->datasheet = datasheet_create (NULL);
@@ -377,3 +374,14 @@
return datasheet_get_row (cf->datasheet, casenum, c);
}
+
+
+
+struct casereader *
+psppire_case_file_make_reader (PsppireCaseFile *cf)
+{
+ struct casereader *r = datasheet_make_reader (cf->datasheet);
+ cf->accessible = FALSE;
+ return r;
+}
+
Index: psppire-case-file.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-case-file.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- psppire-case-file.h 7 Jun 2007 06:42:06 -0000 1.12
+++ psppire-case-file.h 12 Jun 2007 01:59:00 -0000 1.13
@@ -49,14 +49,15 @@
typedef struct _PsppireCaseFileClass PsppireCaseFileClass;
struct ccase;
-struct flexifile;
-struct casefile;
+struct casereader;
struct _PsppireCaseFile
{
GObject parent;
+ /* <private> */
struct datasheet *datasheet;
+ gboolean accessible;
};
@@ -69,7 +70,7 @@
/* -- PsppireCaseFile --- */
GType psppire_case_file_get_type (void);
-PsppireCaseFile *psppire_case_file_new (void);
+PsppireCaseFile *psppire_case_file_new (struct casereader *);
gboolean psppire_case_file_insert_case (PsppireCaseFile *cf, struct ccase *c,
gint row);
@@ -98,16 +99,12 @@
gboolean psppire_case_file_insert_values (PsppireCaseFile *cf, gint n_values,
gint before);
struct case_ordering;
+
void psppire_case_file_sort (PsppireCaseFile *cf, struct case_ordering *);
gboolean psppire_case_file_get_case (const PsppireCaseFile *cf, gint casenum,
struct ccase *c);
-void psppire_case_file_replace_datasheet (PsppireCaseFile *,
- struct datasheet *);
-
-
-
G_END_DECLS
#endif /* __PSPPIRE_CASE_FILE_H__ */
Index: psppire-data-store.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- psppire-data-store.c 8 Jun 2007 04:54:02 -0000 1.35
+++ psppire-data-store.c 12 Jun 2007 01:59:00 -0000 1.36
@@ -373,29 +373,16 @@
}
-
-/**
- * psppire_data_store_replace_set_dictionary:
- * @data_store: The variable store
- * @dict: The dictionary to set
- *
- * If a dictionary is already associated with the data-store, then it will be
- * destroyed.
- **/
void
-psppire_data_store_set_dictionary (PsppireDataStore *data_store, PsppireDict
*dict)
+psppire_data_store_set_case_file (PsppireDataStore *data_store,
+ PsppireCaseFile *cf)
{
- data_store->dict = dict;
-
if ( data_store->case_file)
{
g_object_unref (data_store->case_file);
- data_store->case_file = 0;
}
- data_store->case_file = psppire_case_file_new ();
-
-
+ data_store->case_file = cf;
g_signal_connect (data_store->case_file, "cases-deleted",
G_CALLBACK (delete_cases_callback),
@@ -409,6 +396,22 @@
g_signal_connect (data_store->case_file, "case-changed",
G_CALLBACK (changed_case_callback),
data_store);
+}
+
+
+
+/**
+ * psppire_data_store_replace_set_dictionary:
+ * @data_store: The variable store
+ * @dict: The dictionary to set
+ *
+ * If a dictionary is already associated with the data-store, then it will be
+ * destroyed.
+ **/
+void
+psppire_data_store_set_dictionary (PsppireDataStore *data_store, PsppireDict
*dict)
+{
+ data_store->dict = dict;
g_signal_connect (dict, "variable-inserted",
G_CALLBACK (insert_variable_callback),
Index: psppire-data-store.h
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire-data-store.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- psppire-data-store.h 24 Dec 2006 22:49:18 -0000 1.8
+++ psppire-data-store.h 12 Jun 2007 01:59:00 -0000 1.9
@@ -84,6 +84,9 @@
inline GType psppire_data_store_get_type (void) G_GNUC_CONST;
PsppireDataStore *psppire_data_store_new (PsppireDict *dict);
+void psppire_data_store_set_case_file (PsppireDataStore *data_store,
+ PsppireCaseFile *cf);
+
void psppire_data_store_set_dictionary (PsppireDataStore *data_store,
PsppireDict *dict);
Index: psppire.c
===================================================================
RCS file: /sources/pspp/pspp/src/ui/gui/psppire.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -b -r1.42 -r1.43
--- psppire.c 7 Jun 2007 06:42:06 -0000 1.42
+++ psppire.c 12 Jun 2007 01:59:01 -0000 1.43
@@ -68,10 +68,9 @@
static void
replace_casereader (struct casereader *s)
{
- struct datasheet *datasheet = datasheet_create (s);
+ PsppireCaseFile *pcf = psppire_case_file_new (s);
- psppire_case_file_replace_datasheet (the_data_store->case_file,
- datasheet);
+ psppire_data_store_set_case_file (the_data_store, pcf);
}
void
@@ -100,11 +99,12 @@
the_dataset = create_dataset (replace_casereader,
replace_dictionary);
+
+
message_dialog_init (the_source_stream);
- dictionary = psppire_dict_new_from_dict (
- dataset_dict (the_dataset)
- );
+ dictionary = psppire_dict_new_from_dict (dataset_dict (the_dataset));
+
bind_textdomain_codeset (PACKAGE, "UTF-8");
@@ -113,10 +113,7 @@
the_var_store = psppire_var_store_new (dictionary);
the_data_store = psppire_data_store_new (dictionary);
-
-
- proc_set_active_file_data (the_dataset,
- datasheet_make_reader
(the_data_store->case_file->datasheet));
+ replace_casereader (NULL);
create_icon_factory ();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pspp-cvs] pspp/src/ui/gui psppire-case-file.c psppire-cas...,
John Darrington <=