aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/table
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/table')
-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
7 files changed, 17 insertions, 39 deletions
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 *