aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook')
-rw-r--r--addressbook/ChangeLog15
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c7
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c25
3 files changed, 42 insertions, 5 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7f2d511449..7a8571d026 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,5 +1,20 @@
2001-05-31 Chris Toshok <toshok@ximian.com>
+ * gui/widgets/e-addressbook-model.c (remove_card): decrement
+ data_count before emitting the card_removed signal, and break
+ after we've removed the matching card.
+ (e_addressbook_model_class_init): change signature of
+ "card_removed" signal to match what we emit (and what is
+ expected.)
+
+ * gui/widgets/e-addressbook-view.c (e_addressbook_view_init): the
+ signal name is "destroy", not "destroyed".
+ (do_remove): new function, actually remove the card.
+ (e_addressbook_view_delete_selection): get this working for both
+ view types.
+
+2001-05-31 Chris Toshok <toshok@ximian.com>
+
* gui/component/addressbook.c: Print Preview =>
ContactsPrintPreview. Changed peter's change so that the node
name is more in line with "Print.."'s
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index db87e6fbaf..9183ee0831 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -142,9 +142,12 @@ remove_card(EBookView *book_view,
if ( !strcmp(e_card_get_id(model->data[i]), id) ) {
gtk_object_unref(GTK_OBJECT(model->data[i]));
memmove(model->data + i, model->data + i + 1, (model->data_count - i - 1) * sizeof (ECard *));
+ model->data_count--;
+
gtk_signal_emit (GTK_OBJECT (model),
e_addressbook_model_signals [CARD_REMOVED],
i);
+ break;
}
}
}
@@ -246,8 +249,8 @@ e_addressbook_model_class_init (GtkObjectClass *object_class)
GTK_RUN_LAST,
object_class->type,
GTK_SIGNAL_OFFSET (EAddressbookModelClass, card_removed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
+ gtk_marshal_NONE__INT,
+ GTK_TYPE_NONE, 1, GTK_TYPE_INT);
e_addressbook_model_signals [CARD_CHANGED] =
gtk_signal_new ("card_changed",
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 3491b8e662..f04c9c37c3 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -216,7 +216,7 @@ e_addressbook_view_init (EAddressbookView *eav)
gtk_signal_connect (GTK_OBJECT(eav->invisible), "selection_received",
GTK_SIGNAL_FUNC (selection_received),
eav);
- gtk_signal_connect (GTK_OBJECT(eav->invisible), "destroyed",
+ gtk_signal_connect (GTK_OBJECT(eav->invisible), "destroy",
GTK_SIGNAL_FUNC (invisible_destroyed),
eav);
}
@@ -1104,6 +1104,24 @@ card_deleted_cb (EBook* book, EBookStatus status, gpointer user_data)
g_print ("%s: %s(): a card was deleted\n", __FILE__, __FUNCTION__);
}
+static void
+do_remove (int i, gpointer user_data)
+{
+ EBook *book;
+ ECard *card;
+ EAddressbookView *view = user_data;
+
+ gtk_object_get (GTK_OBJECT(view->model),
+ "book", &book,
+ NULL);
+
+ card = e_addressbook_model_get_card (view->model, i);
+
+ e_book_remove_card(book, card, card_deleted_cb, NULL);
+
+ gtk_object_unref (GTK_OBJECT (card));
+}
+
void
e_addressbook_view_delete_selection(EAddressbookView *view)
{
@@ -1111,8 +1129,9 @@ e_addressbook_view_delete_selection(EAddressbookView *view)
g_return_if_fail (model);
- if (view->view_type == E_ADDRESSBOOK_VIEW_MINICARD)
- e_minicard_view_widget_remove_selection (E_MINICARD_VIEW_WIDGET(view->object), card_deleted_cb, NULL);
+ e_selection_model_foreach (model,
+ do_remove,
+ view);
}
static void