aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--addressbook/ChangeLog5
-rw-r--r--addressbook/gui/component/e-addressbook-model.c24
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c24
3 files changed, 39 insertions, 14 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 46b4a4046b..72b783b727 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,3 +1,8 @@
+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.
+
2000-07-31 Christopher James Lahey <clahey@helixcode.com>
* gui/component/addressbook.c: Changed the default set of columns.
diff --git a/addressbook/gui/component/e-addressbook-model.c b/addressbook/gui/component/e-addressbook-model.c
index ee36d2ca1a..4eb4a0f937 100644
--- a/addressbook/gui/component/e-addressbook-model.c
+++ b/addressbook/gui/component/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. */
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. */