aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c7
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c25
2 files changed, 27 insertions, 5 deletions
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