From 8cb9e29ae525f39382cf7f06e8e988286fec0a47 Mon Sep 17 00:00:00 2001 From: Christopher James Lahey Date: Wed, 27 Jun 2001 03:17:29 +0000 Subject: memmove counts were off in this function. (remove_card, modify_card): 2001-06-26 Christopher James Lahey * gui/widgets/e-addressbook-table-adapter.c (create_card): memmove counts were off in this function. (remove_card, modify_card): Moved the table notifications around a bit here. svn path=/trunk/; revision=10525 --- addressbook/ChangeLog | 7 +++++++ addressbook/gui/widgets/e-addressbook-table-adapter.c | 14 +++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) (limited to 'addressbook') diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 970fb7be26..23319f1fef 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,10 @@ +2001-06-26 Christopher James Lahey + + * gui/widgets/e-addressbook-table-adapter.c (create_card): memmove + counts were off in this function. + (remove_card, modify_card): Moved the table notifications around a + bit here. + 2001-06-26 Christopher James Lahey * gui/component/select-names/e-select-names.c, diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c b/addressbook/gui/widgets/e-addressbook-table-adapter.c index b54b2bcea8..0660bbd13a 100644 --- a/addressbook/gui/widgets/e-addressbook-table-adapter.c +++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c @@ -265,12 +265,11 @@ create_card (EAddressbookModel *model, priv->count += count; priv->simples = g_renew(ECardSimple *, priv->simples, priv->count); - memmove (priv->simples + index + count - 1, priv->simples + index, count * sizeof (ECardSimple*)); + memmove (priv->simples + index + count, priv->simples + index, (priv->count - index - count) * sizeof (ECardSimple *)); e_table_model_pre_change (E_TABLE_MODEL (adapter)); for (i = 0; i < count; i ++) { priv->simples[index + i] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index + i)); - gtk_object_ref (GTK_OBJECT (priv->simples[index + i])); } e_table_model_rows_inserted (E_TABLE_MODEL (adapter), index, count); } @@ -281,9 +280,11 @@ remove_card (EAddressbookModel *model, EAddressbookTableAdapter *adapter) { EAddressbookTableAdapterPrivate *priv = adapter->priv; + + e_table_model_pre_change (E_TABLE_MODEL (adapter)); + gtk_object_unref (GTK_OBJECT (priv->simples[index])); - if (priv->count > 1) - memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple*)); + memmove (priv->simples + index, priv->simples + index + 1, (priv->count - index - 1) * sizeof (ECardSimple *)); priv->count --; e_table_model_rows_deleted (E_TABLE_MODEL (adapter), index, 1); } @@ -294,10 +295,13 @@ modify_card (EAddressbookModel *model, EAddressbookTableAdapter *adapter) { EAddressbookTableAdapterPrivate *priv = adapter->priv; - e_table_model_row_changed (E_TABLE_MODEL (adapter), index); + + e_table_model_pre_change (E_TABLE_MODEL (adapter)); + gtk_object_unref (GTK_OBJECT (priv->simples[index])); priv->simples[index] = e_card_simple_new (e_addressbook_model_card_at (priv->model, index)); gtk_object_ref (GTK_OBJECT (priv->simples[index])); + e_table_model_row_changed (E_TABLE_MODEL (adapter), index); } static void -- cgit