aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/widgets
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2001-06-01 05:26:19 +0800
committerChris Toshok <toshok@src.gnome.org>2001-06-01 05:26:19 +0800
commit6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01 (patch)
tree71b62a8f580774eaf90d24d65533f60b69b56072 /addressbook/gui/widgets
parente5ecf5d84ed197d93afd30fd1ce40384f01be09e (diff)
downloadgsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar.gz
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar.bz2
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar.lz
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar.xz
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.tar.zst
gsoc2013-evolution-6b6d9e32a4848b5fcb54ad83b681a828e6ed2a01.zip
decrement data_count before emitting the card_removed signal, and break
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. svn path=/trunk/; revision=10071
Diffstat (limited to 'addressbook/gui/widgets')
-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