aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-02 18:44:28 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-02 18:44:28 +0800
commit2e8ac028ee909ed15ad69fe7836340d5eb556e1e (patch)
treea083baf7036ee78142cda0e604c032db969a8430 /widgets
parentc03a0bf83596176d50d349c41458284ab69d0d18 (diff)
downloadgsoc2013-evolution-2e8ac028ee909ed15ad69fe7836340d5eb556e1e.tar.gz
gsoc2013-evolution-2e8ac028ee909ed15ad69fe7836340d5eb556e1e.tar.zst
gsoc2013-evolution-2e8ac028ee909ed15ad69fe7836340d5eb556e1e.zip
Changed the API for the append_row function. Now accepts a model to copy
2000-08-02 Christopher James Lahey <clahey@helixcode.com> * e-table-model.c, e-table-model.h: Changed the API for the append_row function. Now accepts a model to copy data from instead of returning a row number and leaving it up to ETableOne to copy the data in. * e-table-one.c, e-table-one.h: Adapted to use new append_row API. * e-table-simple.c, e-table-simple.h, e-table-subset.c: Adapted to supply new append_row API. svn path=/trunk/; revision=4468
Diffstat (limited to 'widgets')
-rw-r--r--widgets/e-table/ChangeLog12
-rw-r--r--widgets/e-table/e-table-model.c12
-rw-r--r--widgets/e-table/e-table-model.h4
-rw-r--r--widgets/e-table/e-table-one.c12
-rw-r--r--widgets/e-table/e-table-one.h2
-rw-r--r--widgets/e-table/e-table-simple.c8
-rw-r--r--widgets/e-table/e-table-simple.h2
-rw-r--r--widgets/e-table/e-table-subset.c16
-rw-r--r--widgets/table/e-table-model.c12
-rw-r--r--widgets/table/e-table-model.h4
-rw-r--r--widgets/table/e-table-one.c12
-rw-r--r--widgets/table/e-table-one.h2
-rw-r--r--widgets/table/e-table-simple.c8
-rw-r--r--widgets/table/e-table-simple.h2
-rw-r--r--widgets/table/e-table-subset.c16
15 files changed, 46 insertions, 78 deletions
diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog
index 002a67617c..7a11420a68 100644
--- a/widgets/e-table/ChangeLog
+++ b/widgets/e-table/ChangeLog
@@ -1,3 +1,15 @@
+2000-08-02 Christopher James Lahey <clahey@helixcode.com>
+
+ * e-table-model.c, e-table-model.h: Changed the API for the
+ append_row function. Now accepts a model to copy data from
+ instead of returning a row number and leaving it up to ETableOne
+ to copy the data in.
+
+ * e-table-one.c, e-table-one.h: Adapted to use new append_row API.
+
+ * e-table-simple.c, e-table-simple.h, e-table-subset.c: Adapted to
+ supply new append_row API.
+
2000-07-31 Christopher James Lahey <clahey@helixcode.com>
* e-table-col.c, e-table-col.h: Added an argument to set a column
diff --git a/widgets/e-table/e-table-model.c b/widgets/e-table/e-table-model.c
index 5045f68b02..7f07bd9787 100644
--- a/widgets/e-table/e-table-model.c
+++ b/widgets/e-table/e-table-model.c
@@ -85,16 +85,14 @@ e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row)
return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row);
}
-gint
-e_table_model_append_row (ETableModel *e_table_model)
+void
+e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row)
{
- g_return_val_if_fail (e_table_model != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), -1);
+ g_return_if_fail (e_table_model != NULL);
+ g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_CLASS (e_table_model)->append_row)
- return ETM_CLASS (e_table_model)->append_row (e_table_model);
- else
- return -1;
+ ETM_CLASS (e_table_model)->append_row (e_table_model, source, row);
}
void *
diff --git a/widgets/e-table/e-table-model.h b/widgets/e-table/e-table-model.h
index dc18d972b5..447903c83a 100644
--- a/widgets/e-table/e-table-model.h
+++ b/widgets/e-table/e-table-model.h
@@ -25,7 +25,7 @@ typedef struct {
void *(*value_at) (ETableModel *etm, int col, int row);
void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
gboolean (*is_cell_editable) (ETableModel *etm, int col, int row);
- gint (*append_row) (ETableModel *etm);
+ void (*append_row) (ETableModel *etm, ETableModel *source, int row);
/* Allocate a copy of the given value. */
void *(*duplicate_value) (ETableModel *etm, int col, const void *value);
@@ -65,7 +65,7 @@ int e_table_model_row_count (ETableModel *e_table_model);
void *e_table_model_value_at (ETableModel *e_table_model, int col, int row);
void e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *value);
gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row);
-gint e_table_model_append_row (ETableModel *e_table_model);
+void e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row);
void *e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value);
void e_table_model_free_value (ETableModel *e_table_model, int col, void *value);
diff --git a/widgets/e-table/e-table-one.c b/widgets/e-table/e-table-one.c
index 73022a5801..40c24517f8 100644
--- a/widgets/e-table/e-table-one.c
+++ b/widgets/e-table/e-table-one.c
@@ -216,7 +216,7 @@ e_table_one_new (ETableModel *source)
return (ETableModel *) eto;
}
-gint
+void
e_table_one_commit (ETableOne *one)
{
if (one->source) {
@@ -229,16 +229,8 @@ e_table_one_commit (ETableOne *one)
break;
}
}
-
if (!empty) {
- int row = e_table_model_append_row(one->source);
- if (row != -1) {
- for (col = 0; col < cols; col++) {
- e_table_model_set_value_at(one->source, col, row, one->data[col]);
- }
- }
- return row;
+ e_table_model_append_row(one->source, E_TABLE_MODEL(one), 0);
}
}
- return -1;
}
diff --git a/widgets/e-table/e-table-one.h b/widgets/e-table/e-table-one.h
index 933d2c7a2d..c6958cee3a 100644
--- a/widgets/e-table/e-table-one.h
+++ b/widgets/e-table/e-table-one.h
@@ -24,7 +24,7 @@ typedef struct {
GtkType e_table_one_get_type (void);
ETableModel *e_table_one_new (ETableModel *source);
-gint e_table_one_commit (ETableOne *one);
+void e_table_one_commit (ETableOne *one);
#endif /* _E_TABLE_ONE_H_ */
diff --git a/widgets/e-table/e-table-simple.c b/widgets/e-table/e-table-simple.c
index fa0a25f784..8c8ed87b70 100644
--- a/widgets/e-table/e-table-simple.c
+++ b/widgets/e-table/e-table-simple.c
@@ -127,15 +127,13 @@ simple_value_to_string (ETableModel *etm, int col, const void *value)
return g_strdup ("");
}
-static int
-simple_append_row (ETableModel *etm)
+static void
+simple_append_row (ETableModel *etm, ETableModel *source, int row)
{
ETableSimple *simple = E_TABLE_SIMPLE(etm);
if (simple->append_row)
- return simple->append_row (etm, simple->data);
- else
- return -1;
+ simple->append_row (etm, source, row, simple->data);
}
static void
diff --git a/widgets/e-table/e-table-simple.h b/widgets/e-table/e-table-simple.h
index 7fbed8d28b..34e76eed79 100644
--- a/widgets/e-table/e-table-simple.h
+++ b/widgets/e-table/e-table-simple.h
@@ -15,7 +15,7 @@ typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *da
typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data);
-typedef gint (*ETableSimpleAppendRowFn) (ETableModel *etm, void *data);
+typedef void (*ETableSimpleAppendRowFn) (ETableModel *etm, ETableModel *model, int row, void *data);
typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data);
typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data);
typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data);
diff --git a/widgets/e-table/e-table-subset.c b/widgets/e-table/e-table-subset.c
index 7da6b0c1b8..8ba5ed03e3 100644
--- a/widgets/e-table/e-table-subset.c
+++ b/widgets/e-table/e-table-subset.c
@@ -81,21 +81,11 @@ etss_is_cell_editable (ETableModel *etm, int col, int row)
return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
}
-static gint
-etss_append_row (ETableModel *etm)
+static void
+etss_append_row (ETableModel *etm, ETableModel *source, int row)
{
ETableSubset *etss = (ETableSubset *)etm;
- gint source_row = e_table_model_append_row (etss->source);
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == source_row){
- return i;
- }
- }
- return -1;
+ e_table_model_append_row (etss->source, source, row);
}
static void *
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
index 5045f68b02..7f07bd9787 100644
--- a/widgets/table/e-table-model.c
+++ b/widgets/table/e-table-model.c
@@ -85,16 +85,14 @@ e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row)
return ETM_CLASS (e_table_model)->is_cell_editable (e_table_model, col, row);
}
-gint
-e_table_model_append_row (ETableModel *e_table_model)
+void
+e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row)
{
- g_return_val_if_fail (e_table_model != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), -1);
+ g_return_if_fail (e_table_model != NULL);
+ g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
if (ETM_CLASS (e_table_model)->append_row)
- return ETM_CLASS (e_table_model)->append_row (e_table_model);
- else
- return -1;
+ ETM_CLASS (e_table_model)->append_row (e_table_model, source, row);
}
void *
diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h
index dc18d972b5..447903c83a 100644
--- a/widgets/table/e-table-model.h
+++ b/widgets/table/e-table-model.h
@@ -25,7 +25,7 @@ typedef struct {
void *(*value_at) (ETableModel *etm, int col, int row);
void (*set_value_at) (ETableModel *etm, int col, int row, const void *value);
gboolean (*is_cell_editable) (ETableModel *etm, int col, int row);
- gint (*append_row) (ETableModel *etm);
+ void (*append_row) (ETableModel *etm, ETableModel *source, int row);
/* Allocate a copy of the given value. */
void *(*duplicate_value) (ETableModel *etm, int col, const void *value);
@@ -65,7 +65,7 @@ int e_table_model_row_count (ETableModel *e_table_model);
void *e_table_model_value_at (ETableModel *e_table_model, int col, int row);
void e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *value);
gboolean e_table_model_is_cell_editable (ETableModel *e_table_model, int col, int row);
-gint e_table_model_append_row (ETableModel *e_table_model);
+void e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row);
void *e_table_model_duplicate_value (ETableModel *e_table_model, int col, const void *value);
void e_table_model_free_value (ETableModel *e_table_model, int col, void *value);
diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c
index 73022a5801..40c24517f8 100644
--- a/widgets/table/e-table-one.c
+++ b/widgets/table/e-table-one.c
@@ -216,7 +216,7 @@ e_table_one_new (ETableModel *source)
return (ETableModel *) eto;
}
-gint
+void
e_table_one_commit (ETableOne *one)
{
if (one->source) {
@@ -229,16 +229,8 @@ e_table_one_commit (ETableOne *one)
break;
}
}
-
if (!empty) {
- int row = e_table_model_append_row(one->source);
- if (row != -1) {
- for (col = 0; col < cols; col++) {
- e_table_model_set_value_at(one->source, col, row, one->data[col]);
- }
- }
- return row;
+ e_table_model_append_row(one->source, E_TABLE_MODEL(one), 0);
}
}
- return -1;
}
diff --git a/widgets/table/e-table-one.h b/widgets/table/e-table-one.h
index 933d2c7a2d..c6958cee3a 100644
--- a/widgets/table/e-table-one.h
+++ b/widgets/table/e-table-one.h
@@ -24,7 +24,7 @@ typedef struct {
GtkType e_table_one_get_type (void);
ETableModel *e_table_one_new (ETableModel *source);
-gint e_table_one_commit (ETableOne *one);
+void e_table_one_commit (ETableOne *one);
#endif /* _E_TABLE_ONE_H_ */
diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c
index fa0a25f784..8c8ed87b70 100644
--- a/widgets/table/e-table-simple.c
+++ b/widgets/table/e-table-simple.c
@@ -127,15 +127,13 @@ simple_value_to_string (ETableModel *etm, int col, const void *value)
return g_strdup ("");
}
-static int
-simple_append_row (ETableModel *etm)
+static void
+simple_append_row (ETableModel *etm, ETableModel *source, int row)
{
ETableSimple *simple = E_TABLE_SIMPLE(etm);
if (simple->append_row)
- return simple->append_row (etm, simple->data);
- else
- return -1;
+ simple->append_row (etm, source, row, simple->data);
}
static void
diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h
index 7fbed8d28b..34e76eed79 100644
--- a/widgets/table/e-table-simple.h
+++ b/widgets/table/e-table-simple.h
@@ -15,7 +15,7 @@ typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *da
typedef void *(*ETableSimpleValueAtFn) (ETableModel *etm, int col, int row, void *data);
typedef void (*ETableSimpleSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
typedef gboolean (*ETableSimpleIsCellEditableFn) (ETableModel *etm, int col, int row, void *data);
-typedef gint (*ETableSimpleAppendRowFn) (ETableModel *etm, void *data);
+typedef void (*ETableSimpleAppendRowFn) (ETableModel *etm, ETableModel *model, int row, void *data);
typedef void *(*ETableSimpleDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data);
typedef void (*ETableSimpleFreeValueFn) (ETableModel *etm, int col, void *val, void *data);
typedef void *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data);
diff --git a/widgets/table/e-table-subset.c b/widgets/table/e-table-subset.c
index 7da6b0c1b8..8ba5ed03e3 100644
--- a/widgets/table/e-table-subset.c
+++ b/widgets/table/e-table-subset.c
@@ -81,21 +81,11 @@ etss_is_cell_editable (ETableModel *etm, int col, int row)
return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
}
-static gint
-etss_append_row (ETableModel *etm)
+static void
+etss_append_row (ETableModel *etm, ETableModel *source, int row)
{
ETableSubset *etss = (ETableSubset *)etm;
- gint source_row = e_table_model_append_row (etss->source);
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- for (i = 0; i < n; i++){
- if (map_table [i] == source_row){
- return i;
- }
- }
- return -1;
+ e_table_model_append_row (etss->source, source, row);
}
static void *