From 0cebe028cbf4d2292740c2b4cfb71efe57b3087e Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Tue, 3 Apr 2001 14:50:38 +0000 Subject: Made this table model more consistent in the number of columns it has. 2001-04-03 Christopher James Lahey * gui/widgets/e-addressbook-model.c (COLS): Made this table model more consistent in the number of columns it has. (addressbook_append_row): Fixed this function. We removed the col offset. svn path=/trunk/; revision=9129 --- addressbook/gui/widgets/e-addressbook-model.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'addressbook/gui') diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c index 71c0db892c..abd97c8464 100644 --- a/addressbook/gui/widgets/e-addressbook-model.c +++ b/addressbook/gui/widgets/e-addressbook-model.c @@ -37,6 +37,8 @@ enum { LAST_SIGNAL }; +#define COLS (E_CARD_SIMPLE_FIELD_LAST - 5) + static guint e_addressbook_model_signals [LAST_SIGNAL] = {0, }; static void @@ -90,7 +92,7 @@ addressbook_destroy(GtkObject *object) static int addressbook_col_count (ETableModel *etc) { - return E_CARD_SIMPLE_FIELD_LAST - 4; + return COLS; } /* This function returns the number of rows in our ETableModel. */ @@ -107,7 +109,7 @@ addressbook_value_at (ETableModel *etc, int col, int row) { EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); const char *value; - if ( col >= E_CARD_SIMPLE_FIELD_LAST || row >= addressbook->data_count ) + if ( col >= COLS || row >= addressbook->data_count ) return NULL; value = e_card_simple_get_const(addressbook->data[row], @@ -122,7 +124,7 @@ addressbook_set_value_at (ETableModel *etc, int col, int row, const void *val) EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etc); ECard *card; if (addressbook->editable) { - if ( col >= E_CARD_SIMPLE_FIELD_LAST|| row >= addressbook->data_count ) + if ( col >= COLS|| row >= addressbook->data_count ) return; e_card_simple_set(addressbook->data[row], col, @@ -154,10 +156,10 @@ addressbook_append_row (ETableModel *etm, ETableModel *source, gint row) card = e_card_new(""); simple = e_card_simple_new(card); - for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST - 1; col++) { + for (col = 0; col < COLS; col++) { const void *val = e_table_model_value_at(source, col, row); e_card_simple_set(simple, - col + 1, + col, val); } e_card_simple_sync_card(simple); -- cgit v1.2.3