aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-02 18:45:09 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-02 18:45:09 +0800
commit48726e6209e3d1febb8f1202340997ec3c7aaee5 (patch)
tree3b5bb56d3ff6701103b26b119be0c30d4cf7f765 /addressbook/gui/widgets
parent2e8ac028ee909ed15ad69fe7836340d5eb556e1e (diff)
downloadgsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar.gz
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar.bz2
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar.lz
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar.xz
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.tar.zst
gsoc2013-evolution-48726e6209e3d1febb8f1202340997ec3c7aaee5.zip
Adapted this to supply the new append_row API of ETableModel.
2000-08-02 Christopher James Lahey <clahey@helixcode.com> * gui/component/e-addressbook-model.c: Adapted this to supply the new append_row API of ETableModel. svn path=/trunk/; revision=4469
Diffstat (limited to 'addressbook/gui/widgets')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index ee36d2ca1a..4eb4a0f937 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -117,17 +117,27 @@ addressbook_is_cell_editable (ETableModel *etc, int col, int row)
return E_ADDRESSBOOK_MODEL(etc)->editable;
}
-static gint
-addressbook_append_row (ETableModel *etm)
+static void
+addressbook_append_row (ETableModel *etm, ETableModel *source, gint row)
{
ECard *card;
- EAddressbookModel *model = E_ADDRESSBOOK_MODEL(etm);
- model->data = g_realloc(model->data, (model->data_count + 1) * sizeof(ECard *));
+ ECardSimple *simple;
+ EAddressbookModel *addressbook = E_ADDRESSBOOK_MODEL(etm);
+ int col;
+
card = e_card_new("");
- model->data[model->data_count++] = e_card_simple_new (card);
+ simple = e_card_simple_new(card);
+
+ for (col = 0; col < E_CARD_SIMPLE_FIELD_LAST - 1; col++) {
+ const void *val = e_table_model_value_at(source, col, row);
+ e_card_simple_set(simple,
+ col + 1,
+ val);
+ }
+ e_card_simple_sync_card(simple);
+ e_book_add_card(addressbook->book, card, NULL, NULL);
+ gtk_object_unref(GTK_OBJECT(simple));
gtk_object_unref(GTK_OBJECT(card));
- e_table_model_row_inserted(E_TABLE_MODEL(model), model->data_count - 1);
- return model->data_count - 1;
}
/* This function duplicates the value passed to it. */